0

I have 2 sheets in my workbook. In the Sheet1, i have a hyperlink which points to Sheet2!Y1. Whenever I click that hyperlink in Sheet1, I want to run the vba code in the another module.

I have data in Sheet1 like below:

A,B,C,D

1,11,111,hyperlink1

2,22,222,hyperlink2

whenever I hit hyperlink1, it should go to Sheet2 and apply filer on the pointed column.

Below is the code I am using for the Worksheet:

Public Sub Worksheet_FollowHyperlink(ByVal Target As Hyperlink)
    If Target.SubAddress = "Sheet2!B1" Then
        MsgBox "Macro"
    End If  
End Sub

The above code is not executing when I am clicking the hyperlink in sheet1. I tried different things, still no luck. Can you help me here?

harry
  • 13
  • 7
  • You may want to start with showing people what you have tried by including that in your question. – braX Jun 13 '20 at 04:06
  • Does this answer your question? [In Excel, can I use a hyperlink to run vba macro?](https://stackoverflow.com/questions/28728600/in-excel-can-i-use-a-hyperlink-to-run-vba-macro) – Masoud Keshavarz Jun 13 '20 at 07:21
  • Hi Masoud - It didn't fix the issue. In my case, the link is in different sheet. Thanks – harry Jul 01 '20 at 11:29

0 Answers0