Sendkeys VBA

ericdmc85

New Member
Joined
Dec 3, 2023
Messages
2
Office Version
  1. 365
  2. 2021
Platform
  1. Windows
Hi,

I have a vba from another post to enable edit mode on a cell without double clicking. It works on the entire worksheet. How do I make it applicable to only certain column, say column F. VBA code I have for the entire worksheet is below:

Private Sub Worksheet_SelectionChange(ByVal Target As Range)
SendKeys "{F2}"
End Sub
 

Excel Facts

Get help while writing formula
Click the italics "fx" icon to the left of the formula bar to open the Functions Arguments dialog. Help is displayed for each argument.
Change your code to this:
VBA Code:
Option Explicit
Private Sub Worksheet_SelectionChange(ByVal Target As Range)
    If Not Intersect(Target, Range("F:F")) Is Nothing Then SendKeys "{F2}"
End Sub
 
Upvote 0
Solution
Thanks for the positive feedback(y), glad having been of some help.
By the way, you probably need to mark this thread as 'Solved'.
 
Upvote 0

Forum statistics

Threads
1,223,246
Messages
6,170,999
Members
452,373
Latest member
TimReeks

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top