Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Westi on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Using Command Button to Offset Excel Selection

Status
Not open for further replies.

tripg

Technical User
Aug 20, 2008
4
US
The cursor is active on an active excel sheet. A form is open. On Clicking a command button on the form, I want the cursor to offset one row. I am using the following:

Private Sub btnLOCback_Click()
Selection.Offset(-1, 0).Select
End Sub

When I click the command button the first time, it offsets properly. When I click it the second time, nothing happens. When I click it the third time, the cursor offsets properly again.

Essentially the button must be clicked twice.

This only happens when the button is on a form. If the button is on the spreadsheet, it works with one click per offset.

Any suggestions?
 




Hi,

Works as expected for me, from a button on a userform in Excel 2003.

How RAPIDLY are you clicking your button?

Skip,

[glasses]Just traded in my old subtlety...
for a NUANCE![tongue]
 
Skip,

If I click within 1.5 seconds it will not offset. Is there a way to lock the command button then while the code is running?
 
Skip,
On a side note, while the button is directly on the sheet and not on a form, there is no delay at all. It can handle the speed. So where is the code slowing down once a form is introduced?
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top