Help needed in VBA code for hyperlink

calvn

New member
Joined
Sep 15, 2020
Messages
1
Reaction score
0
Points
0
Excel Version(s)
MS Office 2019
Hi,

Firstly, thank you for your help in advance.

I have the following code for a macro which opens up necessary file and runs the code. The issue I am facing is that, the macro is not running in all the tabs but only in the tab that it opens in.

I want a hyperlink on every worksheet/tab in cell M1 and linking it back to the Index tab cell A1.

The code is below,

Sub Hyper11()


fnameList = Application.GetOpenFilename(FileFilter:="Microsoft Excel Workbooks (*.xls;*.xlsx;*.xlsm),*.xls;*.xlsx;*.xlsm", Title:="Choose Excel files to add hyperlink in each tab", MultiSelect:=False)
Set wbkSrcBook = Workbooks.Open(Filename:=fnameList)




Dim Ws As Worksheet




For Each Ws In Application.Worksheets


Range("M1").Select
ActiveCell.FormulaR1C1 = "=HYPERLINK(""#'Index'!A1"",""Index"")"
Range("M2").Select

Next Ws

End Sub
 
Back
Top