PDA

View Full Version : Solved: How to Put the Cursor on a Cell Without "Select"?



Cyberdude
10-24-2005, 08:09 PM
When terminating a called procedure, I frequently want to leave the cursor on a specific cell. In the past, I've always used a simple range ".Select" statement. In my quest to remove as many .Select's as I can, I'm looking for a method to substitute for this special case. I can't think of any, but I'm sure one of you wizards knows a way. It's hard to accept that the ONLY way to move the cursor is with a .Select. So how can I do it, Folks? http://vbaexpress.com/forum/images/smilies/102.gif

johnske
10-24-2005, 09:39 PM
When terminating a called procedure, I frequently want to leave the cursor on a specific cell. In the past, I've always used a simple range ".Select" statement. In my quest to remove as many .Select's as I can, I'm looking for a method to substitute for this special case. I can't think of any, but I'm sure one of you wizards knows a way. It's hard to accept that the ONLY way to move the cursor is with a .Select. So how can I do it, Folks? http://vbaexpress.com/forum/images/smilies/102.gifHi Sid,

There's nothing really wrong with something like [A1].Select just before you terminate the procedure, but these will also put the cursor where you want it... [A1].Activate, or, Application.Goto [A1] ', scroll:=False

Regards,
John

Bob Phillips
10-25-2005, 02:10 AM
When terminating a called procedure, I frequently want to leave the cursor on a specific cell. In the past, I've always used a simple range ".Select" statement. In my quest to remove as many .Select's as I can, I'm looking for a method to substitute for this special case. I can't think of any, but I'm sure one of you wizards knows a way. It's hard to accept that the ONLY way to move the cursor is with a .Select. So how can I do it, Folks? http://vbaexpress.com/forum/images/smilies/102.gif

The rationale for removing selects within code is not to avoiding selecting a cell per se, but to avoid the processing that is incurred when you continuously re-select cells, which is usually avoidable. If you want a cell selected. select or some equivalent is unavoidable.

Cyberdude
10-25-2005, 10:58 AM
Useful and interesting comments. Thanx, Fellas. I knew you'd have the answer. :friends:

mdmackillop
10-25-2005, 11:20 AM
I've got a sledgehammer. Any more nuts to crack? (He did ask for the cursor! :devil: )

Sub Cursor()
SendKeys "{F5}E5{ENTER}{F2}"
End Sub