how to tell which hyperlink was clicked
In the followhyperlink event, the event argument Target returns a hyperlink
object reference to the hyperlink that triggered the event.
target.Range.Address would return the address of the cell that contained
the hyperlink
target.address and target.subaddress would return those parts of the
hyperlink.
for testing tryt this
Private Sub FollowHyperlink( target as Hyperlink)
msgbox target.Range.Address & vbnewline _
& target.Address & vbNewLine & target.subAddress
End sub
if the hyperlink is to other pages /ranges, then target.address will
probably be empty.
--
Regards,
Tom Ogilvy
Paul James wrote in message
...
I've got several hyperlinks in a worksheet, and I would like to run some
VBA
code in the FollowHyperlink event of the worksheet. However, I would like
to use a series of "If" statements that test to see which of the several
hyperlinks was clicked, so I can set different lines of code to correspond
to the different links.
How do I test to see which of several different hyperlinks was clicked in
a
worksheet.
(Tom or Dave - can you help me with this one too?)
Thanks in advance,
Paul
|