top of page

Macro to pull all tab names with hyperlinks

Here's a macro that will pull all tab names and generate a hyperlink for them. Just copy paste both codes into VBA project module(s). Code 1 will allow you to go back to the "Master" sheet. Code 2 will create the "Master" tab with the tab names and hyperlinks.

CODE 1: This will not run unless there is a tab named "Master" is present

Sub GotoMaster()

Sheets("Master").Select 'You can change this into a personalized tab name

End Sub


CODE 2:

Sub TabNames()


Dim i As Long

On Error Resume Next

Application.DisplayAlerts = False

Sheets("Master").Delete 'You can change this into a personalized tab name

Application.DisplayAlerts = True

On Error GoTo 0


ThisWorkbook.Sheets.Add _

Before:=ThisWorkbook.Worksheets(1)

ActiveSheet.Name = "Master" 'Change here too


For i = 1 To Sheets.Count

ActiveSheet.Cells(i, 1).Select

ActiveSheet.Hyperlinks.Add _

Anchor:=ActiveSheet.Cells(i, 1), _

Address:="", _

SubAddress:="'" & Sheets(i).Name & "'!A1", _

TextToDisplay:=Sheets(i).Name


Next i


End Sub




0 comments

Комментарии


bottom of page