Worksheet_FollowHyperlink and MsgBox not working in Excel 2010
Cell A1:
=HYPERLINK("#Sheet2!a2","link") Sheet-> View Code
Private Sub Worksheet_FollowHyperlink(ByVal Target As Hyperlink) MsgBox ("hello") End Sub MessageBox does not open when I click on A1; instead, # Sheet2 opens! a2. To further complicate the situation,
Sheet-> View Code
Private Sub Worksheet_BeforeRightClick(ByVal Target As Range, Cancel As Boolean) MsgBox ("hello") End Sub Right-clicking on a cell with a hyperlink launches a message box, but google still works.
Sheet-> View Code
Private Sub Worksheet_BeforeDoubleClick(ByVal Target As Range, Cancel As Boolean) MsgBox ("hello") End Sub Now double-clicking A1 does not create a message box.
Why?
Itβs good that itβs new to me, but in 2003 and 2010 the FollowHyperlink event does not fire for cells containing the HYPERLINK () function. Both versions run for their own hyperlinks.
The SelectionChange event seems to fire, so you can check if there is a hyperlink in the cell or any other tests that you need.