excelschlub
New Member
- Joined
- Nov 14, 2017
- Messages
- 16
Hello,
I need a hyperlink to open a macro, but I am not able to get it to work. At first I thought it was the larger code it was a part of, but I have tried both of the bare bones codes below to get a hyperlink to open a macro and it is not working. I have even tried closing all other excel files and opening a brand new file.
Option 1 - calling by cell address:
Option 2 - calling by hyperlink name:
The hyperlink I have created is in cell A4 on sheet 1 and it has a display name of "mymacro". I am referencing the following: http://learnexcelmacro.com/wp/2012/04/assign-macro-to-hyperlink/
I have tried each of these options independently in brand new .xlsm files. The only thing that happens when I click the link is that the cell (A4) is selected, which is the address of hyperlink. I dont error codes, I dont get anything.
Is there a setting I need to enable or disable?
Thanks for your help!
-Dave
I need a hyperlink to open a macro, but I am not able to get it to work. At first I thought it was the larger code it was a part of, but I have tried both of the bare bones codes below to get a hyperlink to open a macro and it is not working. I have even tried closing all other excel files and opening a brand new file.
Option 1 - calling by cell address:
Code:
Private Sub Worksheet_FollowHyperlink(ByVal Target As Hyperlink)
MsgBox "It worked"
Exit Sub
End If
End Sub
Option 2 - calling by hyperlink name:
Code:
Private Sub Worksheet_FollowHyperlink(ByVal Target As Hyperlink)
If Target.Name = "mymacro" Then
MsgBox "hyperlink name worked"
Exit Sub
End If
End Sub
The hyperlink I have created is in cell A4 on sheet 1 and it has a display name of "mymacro". I am referencing the following: http://learnexcelmacro.com/wp/2012/04/assign-macro-to-hyperlink/
I have tried each of these options independently in brand new .xlsm files. The only thing that happens when I click the link is that the cell (A4) is selected, which is the address of hyperlink. I dont error codes, I dont get anything.
Is there a setting I need to enable or disable?
Thanks for your help!
-Dave