Return to VBA Code Examples

VBA – Create a Hyperlink Menu of Worksheets

Written by

Editorial Team

Reviewed by

Steve Rynearson

Last updated on July 19, 2021


Create Hyperlink Index of All Worksheets in Workbook

Let’s take the Macro to List all Sheets in a Workbook one step further and create a hyperlinked menu for each sheet in a workbook. This is a great time saver for someone that has many sheets and is trying to make a menu of hyperlinks to each one manually.

To use the macro just replace the word Sheet1(it appears twice) in the code with the tab name where you would like the results. Make sure there isn’t any important information on the output tab because it clears the data their before writing to it. After the macro runs, a list of every sheet with a hyperlink to each sheet is created.

dynamic menu

Sub ListSheets()

Dim ws As Worksheet
Dim x As Integer

x = 1

Sheets("Sheet1").Range("A:A").Clear

For Each ws In Worksheets

   Sheets("Sheet1").Cells(x, 1).Select
   ActiveSheet.Hyperlinks.Add _
   Anchor:=Selection, Address:="", SubAddress:= _
   ws.Name & "!A1", TextToDisplay:=ws.Name
   x = x + 1

Next ws

End Sub

VBA Coding Made Easy

Stop searching for VBA code online. Learn more about AutoMacro – A VBA Code Builder that allows beginners to code procedures from scratch with minimal coding knowledge and with many time-saving features for all users!

alt text

 

Learn More!


<<Return to VBA Examples

vba-free-addin

VBA Code Examples Add-in

Easily access all of the code examples found on our site.

Simply navigate to the menu, click, and the code will be inserted directly into your module. .xlam add-in.

(No installation required!)

Free Download

Return to VBA Code Examples