-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathmenu_of_worksheets
More file actions
26 lines (23 loc) · 1011 Bytes
/
Copy pathmenu_of_worksheets
File metadata and controls
26 lines (23 loc) · 1011 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
' this macro creates a sheet with a hyperlink to each existing worksheet in the workbook
' It was pulled from on 1-22-2020 by Goudarzi
' https://www.datanumen.com/blogs/3-methods-to-create-a-list-of-hyperlinks-to-all-worksheets-in-an-excel-workbook/
' 1-22-2020
Sub CreateMenuOfHyperlinksToAllWorksheets()
Dim objSheet As Worksheet
ActiveWorkbook.Sheets.Add(Before:=Worksheets(1)).Name = "Sheet Menu"
Range("A1").Select
For Each objSheet In ActiveWorkbook.Worksheets
If ActiveSheet.Name <> objSheet.Name Then
ActiveCell.Hyperlinks.Add Anchor:=Selection, Address:="", SubAddress:="'" & objSheet.Name & "'" & "!A1", TextToDisplay:=objSheet.Name
ActiveCell.Offset(1, 0).Select
ActiveCell.EntireColumn.AutoFit
End If
Next objSheet
With ActiveSheet
.Rows(1).Insert
.Cells(1, 1) = "MENU"
.Cells(1, 1).Font.Bold = True
.Cells(1, 1).Font.Size = 14
.Cells(1, 1).Columns.AutoFit
End With
End Sub