MrExcel Publishing
Your One Stop for Excel Tips & Solutions

Tab


Posted by David on July 14, 2000 1:17 AM

All right another question from the king of question. If I change cell I2 on this worksheet I want the cursor to go to a button next to I2 so all I have to do is hit enter after the cell is changed.


Posted by JAF on July 18, 0100 1:10 AM

David

I don't know if it's possible to set a macro to run when you hit Enter after a value has been input in cell I2, but you can get the macro to run automatically whenever I2 is changed.

The following (which has to be in the Sheet object) will call a specified macro whenever cell I2 is changed, except when the value in I2 is cleared out. If you want the macro to run even if I2 is blank, simply delete the ' And Target.Value <> "" ' part of the macro.

Private Sub Worksheet_Change(ByVal Target As Excel.Range)
If Target.Address = "$I$2" And Target.Value <> "" Then
Call your_macro
End If
End Sub

Hope this helps - JAF

Posted by david on July 18, 0100 9:17 PM

If you are on the internet and hit tab it takes you to the next button. I want it to put the cursor or attention or focus on the button. Oh well it is not realy important. But thank you for the info.