Please Note: This article is written for users of the following Microsoft Excel versions: 2007, 2010, 2013, and 2016. If you are using an earlier version (Excel 2003 or earlier), this tip may not work for you. For a version of this tip written specifically for earlier versions of Excel, click here: Printing a Worksheet List.

Printing a Worksheet List

by Allen Wyatt
(last updated August 27, 2016)

4

In complex workbooks that contain many worksheets, it is not unusual to need a list of the different worksheets. Once you have the list, you can print it or use it in some other fashion, such as to create a table of contents for your workbook. The following macro, GetSheets, quickly retrieves the names of the worksheets in the current workbook. It places them in the current worksheet, starting at cell A1 and then working downwards.

Sub GetSheets()
    Dim j As Integer
    Dim NumSheets As Integer

    NumSheets = Sheets.Count
    For j = 1 To NumSheets
        Cells(j, 1) = Sheets(j).Name
    Next j
End Sub

This macro will overwrite anything in a cell it needs in the current workbook, so you should make sure you don't need anything in column A of the worksheet. If you don't want to overwrite anything, make sure you create a new worksheet and then run the macro from that worksheet.

Once the list of worksheets is created, you can format it as desired, and then print it out.

Note:

If you would like to know how to use the macros described on this page (or on any other page on the ExcelTips sites), I've prepared a special page that includes helpful information. Click here to open that special page in a new browser tab.

ExcelTips is your source for cost-effective Microsoft Excel training. This tip (12181) applies to Microsoft Excel 2007, 2010, 2013, and 2016. You can find a version of this tip for the older menu interface of Excel here: Printing a Worksheet List.

Author Bio

Allen Wyatt

With more than 50 non-fiction books and numerous magazine articles to his credit, Allen Wyatt is an internationally recognized author. He is president of Sharon Parq Associates, a computer and publishing services company. ...

MORE FROM ALLEN

Detecting Types of Sheets in VBA

When processing workbook information in a macro, you may need to step through each worksheet to make some sort of ...

Discover More

Printing to a Disk File

When printing a worksheet, there may be times when you want to send the printer output to a disk file instead of to the ...

Discover More

Removing Dashes from ISBN Numbers

ISBN numbers are used to denote a unique identifier for a published book. If you remove the dashes included in an ISBN, ...

Discover More

Professional Development Guidance! Four world-class developers offer start-to-finish guidance for building powerful, robust, and secure applications with Excel. The authors show how to consistently make the right design decisions and make the most of Excel's powerful features. Check out Professional Excel Development today!

More ExcelTips (ribbon)

Printing Row Numbers

Excel displays row numbers on-screen that help you easily see what is in each row. If you want to print these row ...

Discover More

Printing a Chart

It is inevitable that if you spend time creating a chart you will want to print that chart on your printer. Here's how ...

Discover More

Specifying a Paper Tray in a Macro

If you are using a macro to create your printed Excel output, you may need a way to specify that paper should come from a ...

Discover More
Subscribe

FREE SERVICE: Get tips like this every week in ExcelTips, a free productivity newsletter. Enter your address and click "Subscribe."

View most recent newsletter.

Comments

If you would like to add an image to your comment (not an avatar, but an image to help in making the point of your comment), include the characters [{fig}] in your comment text. You’ll be prompted to upload your image when you submit the comment. Maximum image size is 6Mpixels. Images larger than 600px wide or 1000px tall will be reduced. Up to three images may be included in a comment. All images are subject to review. Commenting privileges may be curtailed if inappropriate images are posted.

What is 0 + 1?

2016-09-02 12:08:16

Tony O

Further to my previous post, I have now found out where I went wrong and now everything works fine. I had missed a ' sign out and typed "" and not "'".


2016-09-02 09:15:49

Tony O

Thank you for this tip.

I have added the following command which will make sure that the results will always be in the tab called Index

Worksheets("Index").Activate

Alex B's addition works well except I have some tab names that contain spaces and so the links to these tabs do not work. i.e. Tab data.

Is there a way to have the hyperlink adapt the tab name to match what it is expecting?


2016-09-02 00:09:44

Philip

One useful extension of this code is to embed it into a worksheet that you might call "Index" and have it refresh each time the Index sheet activates. Then, by copying this Index sheet into any workbook you have, you get an automatic indexing sheet in a couple of mouse clicks ...


2016-08-27 21:10:27

Alex B

I'm sure this is not the most elegant code but if you replace

Cells(j, 1) = Sheets(j).Name

With the following 2 lines of code, the list will have hyperlinks back to each of the sheets in the list (goes to cell A1)

strSheetName_Addr = "'" & Sheets(j).Name & "'!A1"

ActiveSheet.Hyperlinks.Add anchor:=Cells(j, 1), Address:="", SubAddress:=strSheetName_Addr, TextToDisplay:=Sheets(j).Name


This Site

Got a version of Excel that uses the ribbon interface (Excel 2007 or later)? This site is for you! If you use an earlier version of Excel, visit our ExcelTips site focusing on the menu interface.

Newest Tips
Subscribe

FREE SERVICE: Get tips like this every week in ExcelTips, a free productivity newsletter. Enter your address and click "Subscribe."

(Your e-mail address is not shared with anyone, ever.)

View the most recent newsletter.