Create an Excel VBA Worksheet Index With Back-to-Index Links
Question details
Create a worksheet index that refreshes its list and provides a return link on each worksheet.

- Product
- Microsoft Excel
- Device & OS
- not provided
- Scenario
- A workbook has multiple worksheets, and the user wants to navigate between them and an index sheet.
- Observed behavior
- The index should list the current worksheets, link to each one, and provide a Back to Index link on each worksheet.
Open the workbook in desktop Excel and create or choose an index worksheet. Reserve column A from row 2 onward on the index sheet and cell A1 on every other worksheet; the macro will replace their existing contents.
Rebuild the worksheet index when the index sheet is activated
Use a worksheet event macro to refresh the list and add return links whenever you select the index sheet.
The macro lists worksheets, not chart sheets. It includes hidden worksheets, but their links cannot be followed until the sheets are unhidden. Remove worksheet protection before running it so the macro can write the links.
In desktop Excel, select the index sheet, then choose Developer > Visual Basic. In the Project Explorer, double-click the index worksheet under Microsoft Excel Objects.
Paste this code into the index worksheet's code window: Private Sub Worksheet_Activate() Dim ws As Worksheet Dim nextRow As Long Dim previousEvents As Boolean previousEvents = Application.EnableEvents On Error GoTo CleanUp Application.EnableEvents = False Me.Range("A2:A" & Me.Rows.Count).Hyperlinks.Delete Me.Range("A2:A" & Me.Rows.Count).ClearContents Me.Range("A1").Value = "Worksheet Index" nextRow = 2 For Each ws In Me.Parent.Worksheets If ws.Name <> Me.Name Then Me.Hyperlinks.Add Anchor:=Me.Cells(nextRow, 1), _ Address:="", _ SubAddress:="'" & Replace(ws.Name, "'", "''") & "'!A1", _ TextToDisplay:=ws.Name ws.Range("A1").Hyperlinks.Delete ws.Hyperlinks.Add Anchor:=ws.Range("A1"), _ Address:="", _ SubAddress:="'" & Replace(Me.Name, "'", "''") & "'!A1", _ TextToDisplay:="Back to Index" nextRow = nextRow + 1 End If Next ws CleanUp: Application.EnableEvents = previousEvents If Err.Number <> 0 Then MsgBox "The index could not be fully rebuilt: " & Err.Description, vbExclamation End If End Sub
Choose File > Save As and select Excel Macro-Enabled Workbook (*.xlsm). When reopening the file, enable macros only if you trust the workbook.
Select another worksheet tab, then select the index tab to run the event. Click a worksheet name in the index, then click Back to Index in cell A1 of that worksheet.

Navigate spreadsheets with WPS Office
WPS Office is a free, lightweight Office alternative with a familiar interface and support for common Excel formats, making it easy to move between Office files. Use spreadsheet hyperlinks for navigation; the Excel VBA event macro requires compatible macro support and may not run in every WPS installation.

Frequently Asked Questions
How do I update the index after adding or deleting a worksheet?
Select another worksheet tab and then return to the index tab. The Worksheet_Activate procedure clears and rebuilds the list.
Why does a link to a hidden worksheet not open?
Excel cannot navigate to a hidden worksheet through the link. Right-click a worksheet tab, choose Unhide, and select the sheet before following its index link.
Why is the macro not running in Excel for the web?
Excel for the web cannot run VBA macros. Open the workbook in desktop Excel and enable macros if you trust the file.
Can I keep existing data in cell A1 on each worksheet?
Not with this code as written: it replaces A1 with the return link. Change both references to ws.Range("A1") in the procedure to an unused cell before running it.




