vba code to select cell & put in edit mode

Peter_SSs

MrExcel MVP, Moderator
Joined
May 28, 2005
Messages
63,880
Office Version
  1. 365
Platform
  1. Windows
In vba code, I would like to be able to select a cell and put it in 'edit mode'. That is, I want to be able to do the equivalent (after selecting the cell) of the following keystrokes:

F2
Home
Shift + End

Any help appreciated.

Peter
 

Excel Facts

Which lookup functions find a value equal or greater than the lookup value?
MATCH uses -1 to find larger value (lookup table must be sorted ZA). XLOOKUP uses 1 to find values greater and does not need to be sorted.
Code:
Sub Macro7()
Application.SendKeys "{F2}"
Application.SendKeys "{HOME}"
Application.SendKeys "+{END}"

End Sub
 
Upvote 0
Solution
Why not all at the same time?:

Code:
Public Sub test3()
    Application.SendKeys ("{F2}{HOME}+{END}")
End Sub
 
Upvote 0
Thank you all for your help - it was exactly what I needed.

Peter
 
Upvote 0
Hi Tazguy

If i want to use the same code for a range of cells at one time not only cell by cell

for example

Public Sub test3()
Range("A3:A6").Select
Application.SendKeys ("{F2}{HOME}+{END}")
End Sub


Is it possible ? cuz when am applying this it is stucked only at the A3 and it is not going to other cells at one time

Thanks in advance
 
Upvote 0
Why not just enter the desired cell in the name box?
Then the above macro, Enter.
 
Upvote 0
my bad for not being specific. You are correct that would work. This is sheet will be used by non-Excel users. Sheet1 (Menu), Sheet2 (data), I'm thinking of using a Dropdown list to select users from Sheet2, then click a button to pull up User's name and with options to Edit that name, then save and close.
 
Upvote 0

Forum statistics

Threads
1,216,487
Messages
6,130,944
Members
449,608
Latest member
jacobmudombe

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