Hyperlink to a Macro

  • Thread starter Thread starter Guest
  • Start date Start date
First have the hyperlink point to a cell. When the jump is made to the cell,
use an Event to trigger the macro:

In A1 enter:

=HYPERLINK("#sheet1!Z100","leap")

and in worksheet code have something like:

Private Sub Worksheet_SelectionChange(ByVal Target As Range)
If Intersect(Target, Range("Z100")) Is Nothing Then
Exit Sub
End If
MsgBox ("hello")
End Sub

REMEMBER: worksheet code, not a standard module.
 
If you're using insert|Hyperlink to create those hyperlinks, you may be able to
tie into the Worksheet_FollowHyperlink event.
 
Back
Top