Create macro in excel to show list of all tabs in the excel workbook

Dear Expert,

Needing macro that:
1. Creates a new worksheet as first sheet in the workbook.
2. Lists all worksheets, with a hyperlink on each listed worksheet on the list that takes to the A1 cell of that respective worksheet.

Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.


pls try

Sub macro()
Set shSummary = ActiveWorkbook.Sheets.Add(before:=Sheets(1))
shSummary.Name = "Summary"
Idx = 1
For Each sh In ActiveWorkbook.Worksheets
    If sh.Name <> "Summary" Then
        shSummary.Hyperlinks.Add Anchor:=shSummary.Range("A" & Idx), _
            Address:="", SubAddress:=sh.Name & "!" & "A1", TextToDisplay:=sh.Name
        Idx = Idx + 1
    End If
End Sub

Open in new window

Glenn RayExcel VBA DeveloperCommented:
Hi, this code will re-build an Index sheet even if one already exists:
Option Explicit
Sub Build_Index()
    Dim ws, wsIndex As Worksheet
    Dim x As Integer
    Application.DisplayAlerts = False
    If Sheets(1).Name = "Index" Then Sheets("Index").Delete
    Sheets(1).Name = "Index"
    Set wsIndex = Sheets("Index")
    x = 1
    For Each ws In ThisWorkbook.Worksheets
        If ws.Name <> "Index" Then
            wsIndex.Hyperlinks.Add Anchor:=wsIndex.Cells(x, 1), _
                Address:="", SubAddress:="'" & ws.Name & "'!A1", _
            x = x + 1
        End If
    Next ws
    Application.DisplayAlerts = True
End Sub

Open in new window


Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
Glenn RayExcel VBA DeveloperCommented:

Did you have a chance to review and or test our solutions?  If so, and either/both will work for you, can you please properly close this question by clicking the "Accept this solution" link(s) above the submission(s) that answers your question?.  This will help ensure that future searches are meaningful to other EE members.

Otherwise, let us know if you have any other issues.

easycapitalAuthor Commented:
Sorry. I just landed and back from traveling.
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Microsoft Excel

From novice to tech pro — start learning today.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.