• Hi All

    Please note that at the Chandoo.org Forums there is Zero Tolerance to Spam

    Post Spam and you Will Be Deleted as a User

    Hui...

  • When starting a new post, to receive a quicker and more targeted answer, Please include a sample file in the initial post.

Shortcut to select contents of a cell

obsrvr

New Member
Dear members,

I was wondering if there is a shortcut to select the contents of a cell, and this is very important, when you inside the cell. For example, I have a cell with a long strings of words and I could press F2 and Shift + <-- to select the contents, but when I have many cells to go through it annoys me so much, slowing down everything to the point I no longer feel like doing it :) So I wondering if there is something similar to Ctrl+A (or perhaps some other magical mouse click) to select the contents of the cell once you inside it. Double mouse click selects only the word the pointer at, but not the entire sentence if you will. Is there such thing or I have to "make" a shortcut like this with VBA?

Regards,
obsrvr
 
Hi ,

I am not sure there is a shortcut key to enter edit mode and select all of the text , but using VBA makes it very straightforward.

For those who may not be aware of this , type in ( or copy paste ) the following two procedures in a module :
Code:
Public Sub StartUp()
           Application.OnKey "{F11}", "Sel_text"
End Sub
 
Public Sub Sel_text()
           Application.EditDirectlyInCell = True
           SendKeys "{F2}^+{HOME}"
End Sub

Run the StartUp procedure once , so that the key assignment is done ; if you wish , you can put the single line of code in a Workbook_Open event procedure , so that when ever the file is opened in Excel , the key assignment is done.

Thereafter , when ever the key F11 is pressed , the entire line of text in the cell which has the cursor in it will be selected.

If you wish to RESET the key assignment , run the following procedure once :
Code:
Public Sub Reset_F11()
           Application.OnKey "{F11}"
End Sub

Narayan
 
  • Like
Reactions: Xiq
Back
Top