stormhunter2000
asked on
Auto Click a Tab button
Hello is there anyway to set up a macro the activate a macro when the tab button is pressed on either of these cells z26,z28,z30,z32,z34,z36,z3 8,z40,z42. Thanks
ASKER
Hello, Yes the user enter data in each cell,so when the user gets to cell z26 he will enter his data then when he/she hits the tab button again. It will run a create macro that i have setup
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
Good, that is what i needed thank you for the script
glad i could help, thanks for the grade
i presume excel?
here are two subs
a.
Private Sub Workbook_SheetActivate(ByV
MsgBox "Other sheet selected"
End Sub
b.
Private Sub Workbook_SheetBeforeRightC
Rem declare vars
Dim i As Integer
i = 26
Rem select case to look for the address of current clicked cell
While Not i > 42
If InStr(1, Target.Address, "$Z$", vbTextCompare) Then
If Target.Address = "$Z$" & i Then
Rem selected cell in range so show message
MsgBox "Cell within Range selected"
End If
Else
Rem cell is not in column so exit early
Exit Sub
End If
i = i + 2
Wend
End Sub
a> will show a message box but you can easily add your macro to the handler
b> will show a message box if the cell in your range above is rightclicked
but i guess you need something different could you please explain it better?
:O)Bruintje