1 - Select the worksheet you have the hyperlink(s) on.
2 - Right-click the WS tab. select "View Code".
3 - Select "Worksheet" from the top left combo box.
4 - Select "FollowHyperlink" from the top right combo box.
VBA will generate the event signature for you:
Private Sub Worksheet_FollowHyperlink(ByVal Target As Hyperlink)
'You put your own code here
End Sub
"Target" gives you info on the hyperlink clicked.
There is also the related Workbook_SheetFollowHyperlink, which you can get
to by a similar process as above, but first double click the "ThisWorkbook"
module under your Project:
Private Sub Workbook_SheetFollowHyperlink(ByVal Sh As Object, ByVal Target
As Hyperlink)
End Sub
With this event, you can react to a hyperlink (Target) on any WS (Sh) in
that workbook.
NickHK
"Mack Neff" <(E-Mail Removed)> wrote in message
news:uL82Vi%(E-Mail Removed)...
> OK... this is a start, but I'm really a novice at coding... so far have
just
> recorded macros and followed a few step-by-step VBA projects. Can you be a
> bit more specific?
>
>
> "NickHK" <(E-Mail Removed)> wrote in message
> news:(E-Mail Removed)...
> > There's the Worksheet_FollowHyperlink event that is fired when a
hyperlink
> > is clicked.
> > You can put code there.
> >
> > NickHK
> >
> > "Mack Neff" <(E-Mail Removed)> wrote in message
> > news:(E-Mail Removed)...
> >> Is it possible to assign a macro to a word in a cell - like a
hyperlink -
> >> rather than to a control button?
> >>
> >
> >
>
|