Share via

Create list of tabs in Excel

Anonymous
2012-11-15T19:30:15+00:00

I'm working on a spreadsheet with a lot of tabs. Is there a simple way to generate a list of the tab names?

Thanks.

Microsoft 365 and Office | Excel | For home | Windows

Locked Question. This question was migrated from the Microsoft Support Community. You can vote on whether it's helpful, but you can't add comments or replies or follow the question.

0 comments No comments

Answer accepted by question author

Anonymous
2012-11-15T19:38:41+00:00

You can do this only with VBA code. There is no worksheet function to get sheet names.

Sub ListSheetNames()

    Dim R As Range

    Dim WS As Worksheet

    Set R = ActiveCell

    For Each WS In ThisWorkbook.Worksheets

        R.Value = WS.Name

        Set R = R(2, 1)

    Next WS

End Sub

Select the cell where the list should start and run the code above.

Was this answer helpful?

70+ people found this answer helpful.
0 comments No comments

Answer accepted by question author

Anonymous
2012-11-15T19:37:41+00:00

Put this in a module in your workbook and run it and it should give you a new worksheet containing all of the names

Option Explicit

Sub ListWorksheets()

Dim aWB As Excel.Workbook

Dim WS As Excel.Worksheet

Dim myWS As Excel.Worksheet

Dim lRow As Long

Set aWB = ActiveWorkbook

On Error Resume Next

Set myWS = aWB.Worksheets("Worksheet Names")

On Error GoTo 0

If myWS Is Nothing Then

    Set myWS = aWB.Worksheets.Add

    myWS.Move before:=aWB.Worksheets(1)

    myWS.Name = "Worksheet Names"

Else

    myWS.UsedRange.ClearContents

End If

lRow = 0

For Each WS In aWB.Worksheets

    lRow = lRow + 1

    myWS.Cells(lRow, 1) = WS.Name

Next WS

End Sub

Was this answer helpful?

60+ people found this answer helpful.
0 comments No comments

17 additional answers

Sort by: Most helpful
  1. Anonymous
    2015-02-02T16:00:47+00:00

    Here is another way. It does involve VBA, but is sometimes easier.

    • ALt+F11 to the VBA editor
    • Control+g to open the immediate window
    • type the text below and hit enter:

    for each s in sheets:debug.print s.name:next

    • Select the printed sheetnames from the window and hit control+c to copy them so you can paste anywhere.

    Was this answer helpful?

    100+ people found this answer helpful.
    0 comments No comments
  2. Anonymous
    2015-02-02T16:07:09+00:00

    Well It's an old thread but here's a non VBA method

    Ctrl + F3, New | Name = SheetNames

    Enter this in the refers to box

    =REPLACE(GET.WORKBOOK(1),1,FIND("]",GET.WORKBOOK(1)),"")

    OK Out and put this in a cell and drag down.

    =IFERROR(INDEX(SheetNames,ROWS($A$2:A2)),"")

    Was this answer helpful?

    20+ people found this answer helpful.
    0 comments No comments
  3. Ashish Mathur 101.8K Reputation points Volunteer Moderator
    2012-11-18T00:13:13+00:00

    Hi,

    You may refer to my solution at the following link - http://www.ashishmathur.com/generate-a-list-of-all-tabs-names-without-using-vba/

    Hope this helps.

    Was this answer helpful?

    2 people found this answer helpful.
    0 comments No comments