Link Worksheets to Master Sheet in Excel ๐
Learn how to connect all Excel sheets to a master sheet with VBA, creating a clickable Table of Contents for easy navigation.

Ajay Anand
6.2K views โข Jun 25, 2023

About this video
The VBA program to create a 'Table of Contents' in Excel Workbooks is explained in this video.
Executing this program will add a new worksheet with hyperlinks to every Worksheet of the Workbook. So, this method is a perfect solution for linking every Worksheet of a Workbook to a Master sheet.
๐ VBA Code for creating Table of Contents in Excel
Sub TableofContents()
Dim a As Worksheet, b As Worksheet
Dim c As Range, d As Integer
d = 1
Worksheets(1).Select
For Each b In Worksheets
If b.Name = "ToC" Then
Application.DisplayAlerts = False
Worksheets("Toc").Delete
Application.DisplayAlerts = True
End If
ActiveSheet.Buttons.Add(400, 75, 75, 25).Select
With Selection
.OnAction = "Temp"
.Characters.Text = "Master Sheet"
End With
ActiveSheet.Next.Select
On Error Resume Next
Next
Sheets.Add.Name = "ToC"
Range("C3").Select
ActiveCell.Offset(-1, -1).Value = "S No."
ActiveCell.Offset(-1, 0).Value = "Sheet Name"
For Each a In ActiveWorkbook.Worksheets
If ActiveSheet.Name NET a.Name Then
ActiveCell.Offset(0, -1).Value = d
ActiveCell.Hyperlinks.Add Anchor:=Selection, _
Address:="", SubAddress:="'" & a.Name & "'" & "!A1", _
TextToDisplay:=a.Name
ActiveCell.Offset(1, 0).Select
d = d + 1
End If
Next a
Columns("C:C").EntireColumn.AutoFit
End Sub
Sub Temp()
Sheets("ToC").Select
End Sub
๐ Top 25 Microsoft Word Tips and Tricks - https://youtu.be/l25Evu4ohKg
๐ 7 Most Important Tools in Excel - https://youtu.be/Pc88LGWNO70
๐Download my free eBook on Excel Macros - http://eepurl.com/gpT0RD
๐Check these Books on Excel - https://xlncad.com/excel-resources/
๐Read my articles on Excel - https://xlncad.com/
โ If youโve found my videos helpful or enjoyable, consider supporting me with a coffee!
๐ buymeacoffee.com/ajayanand
Subscribe to @XLnCADMalayalam for Excel, Word, PowerPoint, Access, Python and Power BI Tutorials in Malayalam.
https://www.youtube.com/c/XLnCADMalayalam
๐ข Disclaimer: If you click on my affiliates links, I am going to receive a tiny commission. The products that I advertise are the ones I believe in.
๐โโ๏ธ My Running Kit for Hyderabad Marathon 2025
https://amzn.to/44IILeG
๐ Think Like an Analyst: Books That Helped Me
https://amzn.to/3SNy6bi
๐ Mind-Opening Reads You Canโt Miss
https://amzn.to/43tM2fu
#hyperlinkexcelsheet #excelvba #tableofcontents
Executing this program will add a new worksheet with hyperlinks to every Worksheet of the Workbook. So, this method is a perfect solution for linking every Worksheet of a Workbook to a Master sheet.
๐ VBA Code for creating Table of Contents in Excel
Sub TableofContents()
Dim a As Worksheet, b As Worksheet
Dim c As Range, d As Integer
d = 1
Worksheets(1).Select
For Each b In Worksheets
If b.Name = "ToC" Then
Application.DisplayAlerts = False
Worksheets("Toc").Delete
Application.DisplayAlerts = True
End If
ActiveSheet.Buttons.Add(400, 75, 75, 25).Select
With Selection
.OnAction = "Temp"
.Characters.Text = "Master Sheet"
End With
ActiveSheet.Next.Select
On Error Resume Next
Next
Sheets.Add.Name = "ToC"
Range("C3").Select
ActiveCell.Offset(-1, -1).Value = "S No."
ActiveCell.Offset(-1, 0).Value = "Sheet Name"
For Each a In ActiveWorkbook.Worksheets
If ActiveSheet.Name NET a.Name Then
ActiveCell.Offset(0, -1).Value = d
ActiveCell.Hyperlinks.Add Anchor:=Selection, _
Address:="", SubAddress:="'" & a.Name & "'" & "!A1", _
TextToDisplay:=a.Name
ActiveCell.Offset(1, 0).Select
d = d + 1
End If
Next a
Columns("C:C").EntireColumn.AutoFit
End Sub
Sub Temp()
Sheets("ToC").Select
End Sub
๐ Top 25 Microsoft Word Tips and Tricks - https://youtu.be/l25Evu4ohKg
๐ 7 Most Important Tools in Excel - https://youtu.be/Pc88LGWNO70
๐Download my free eBook on Excel Macros - http://eepurl.com/gpT0RD
๐Check these Books on Excel - https://xlncad.com/excel-resources/
๐Read my articles on Excel - https://xlncad.com/
โ If youโve found my videos helpful or enjoyable, consider supporting me with a coffee!
๐ buymeacoffee.com/ajayanand
Subscribe to @XLnCADMalayalam for Excel, Word, PowerPoint, Access, Python and Power BI Tutorials in Malayalam.
https://www.youtube.com/c/XLnCADMalayalam
๐ข Disclaimer: If you click on my affiliates links, I am going to receive a tiny commission. The products that I advertise are the ones I believe in.
๐โโ๏ธ My Running Kit for Hyderabad Marathon 2025
https://amzn.to/44IILeG
๐ Think Like an Analyst: Books That Helped Me
https://amzn.to/3SNy6bi
๐ Mind-Opening Reads You Canโt Miss
https://amzn.to/43tM2fu
#hyperlinkexcelsheet #excelvba #tableofcontents
Tags and Topics
Browse our collection to discover more content in these categories.
Video Information
Views
6.2K
Likes
105
Duration
4:05
Published
Jun 25, 2023
User Reviews
4.6
(1)