How to List Worksheet Names in Excel?

We may need to get a list of worksheet names in a workbook. For example, we might want to create an index of worksheet names in workbook. To make such a list is not simple, this tutorial is giving instructions on how to list worksheet names in Excel.

List worksheet names by using VBA code

List worksheet names and link to each worksheet by using Kutools for Excel

Kutools for Excel: add 120 new features in Excel. Save one hour every day.
Classic Menu for Office: brings back classic menus to Office 2010 and 2013 (includes Office 365).
Office Tab: brings tabbed interface to Office as the use of web browser Chrome, Firefox and Internet Explorer.

arrow blue right bubble List worksheet names by using VBA code

Hot
Amazing! Using Tabs in Excel like Firefox, Chrome, Internet Explore 10!

The following two VBA codes can help you list all of the worksheet names in a new worksheet or the active worksheet. Please do as this:

1. Click Developer > Visual Basic, a new Microsoft Visual Basic for applications window will be displayed (or you can press the shortcut key Alt + F11 to open the window), then click Insert > Module, and input the following code into the Module:

VBA: List worksheet names in a new worksheet named “KutoolsforExcel”.

Sub ListWorkSheetNamesNewWs()
'Updateby20140624
Dim xWs As Worksheet
On Error Resume Next
Application.DisplayAlerts = False
xTitleId = "KutoolsforExcel"
Application.Sheets(xTitleId).Delete
Application.Sheets.Add Application.Sheets(1)
Set xWs = Application.ActiveSheet
xWs.Name = xTitleId
For i = 2 To Application.Sheets.Count
xWs.Range("A" & (i - 1)) = Application.Sheets(i).Name
Next
Application.DisplayAlerts = True
End Sub

VBA: List worksheet names in active worksheet.

Sub ListWorkSheetNames()
'Updateby20140624
Dim xWs As Worksheet
Set xWs = Application.ActiveSheet
For i = 1 To Application.Sheets.Count
xWs.Range("A" & i) = Application.Sheets(i).Name
Next i
End Sub

2. Then click doc-merge-multiple-workbooks-button button to run the code, and all of the worksheet names in active workbook have been listed.

The above two codes only support to create a list of all worksheet names in the workbook, but if you want to add links to the worksheet names, how could you do? The following method may help you.


arrow blue right bubble List worksheet names and link to each worksheet by using Kutools for Excel

With the Create List of Sheet Names utility of the third party add-in Kutools for Excel, you are able to create a list of worksheet names in one click, and link to each worksheet with hyperlink.

Kutools for Excel: with more than120 handy Excel add-ins, free to try with no limitation in 30 days.Get it Now.

After installing Kutools for Excel, apply Create List of Sheet Names tool according to these steps:

1. Click Enterprise > Worksheet Tools > Create List of Sheet Names, see screenshot:

doc-list-worksheet-names1

2. In the Create List of Sheet Names dialog box, please specify the following settings:

doc-list-worksheet-names2

Choose sheet index styles you like, you can create the worksheet names with hyperlinks or with macro buttons.

Enter the worksheet names for sheet index.

Specify the location of the worksheet index.

Specify how much columns you want to use in the new worksheet to display the worksheet names.

3. After finishing the settings, then click OK. All of the worksheet names have been listed with links in a new worksheet of the current workbook. See screenshot:

worksheet names with hyperlinksworksheet names with macro buttons
doc-list-worksheet-names3doc-list-worksheet-names4

Click to know more about this feature.


Kutools for Excel

More than 120 Advanced Functions for Excel 2013, 2010, 2007 and Office 365.

screen shot

btn read more     btn download     btn purchase

Comments  

0#SamJ2013-10-16 23:03
Great - but how do I do this in Visio ie for an index of worksheets in visio?
Reply | Reply with quote | Quote
0#Ian Alp2014-04-20 05:13
How to list the Sheetname of a sub WB and list them in the Main WB?
Reply | Reply with quote | Quote
+3#Tinman2014-06-08 23:14
The 'Range' step in your ListWorkSheetNames macro generates runtime error 1004: method range of object global failed. I have it saved in a PERSONAL.XLSB module, running from a macro-enabled spreadsheet in Office10. What am I missing?

Sub ListWorkSheetNames()
For i = 1 To Sheets.Count
Range(”A” & i) = Sheets(i).Name
Next i
End Sub
Reply | Reply with quote | Quote
0#perry landau2014-07-24 20:40
the best it worked like charm
Reply | Reply with quote | Quote
0#perry landau2014-07-24 20:41
it's great worked like charm
Reply | Reply with quote | Quote

Add comment


Security code
Refresh