Print out sheets names

Folks,
I would like to print out my worksheets names from a workbook.
.
Frank FreeseAsked:
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.

Martin LissOlder than dirtCommented:
To get a list of the sheet names you can add this (untested) to any module

Sub ListNames()

Dim ws As Worksheet

For Each ws in Worksheets
    Debug.Print ws.name
Next
End Sub

Open in new window


and run it. You can then copy the names you need from the Immediate Window. BTW you can run it from the Immediate Window if you like by just typing ListNames and pressing return
0

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
Harry LeeCommented:
fh_freese,

What do you mean by print out? You mean actually printing it when printing the document to a printer? Or do you mean by creating a list of it?
0
Frank FreeseAuthor Commented:
thanks again
You are appreciated
0
Amazon Web Services

Are you thinking about creating an Amazon Web Services account for your business? Not sure where to start? In this course you’ll get an overview of the history of AWS and take a tour of their user interface.

SteveCommented:
Maybe try:
Sub ListNames()
Dim w As Worksheet
Set w = Worksheets.Add
w.Name = "ListOfSheets"
For x = 1 To Worksheets.Count
    w.Cells(x, 1) = Sheets(x).Name
Next
End Sub

Open in new window

0
Martin LissOlder than dirtCommented:
You're welcome.
0
Martin LissOlder than dirtCommented:
I found a small bug in our code. Change this

Private Sub Workbook_Open()

Dim intIndex As Integer

With Worksheets("Menu")
    For intIndex = 1 To LAST_MENU_ROW
        Cells(intIndex, 1).Value = ""
    Next
End With
ActiveWindow.ScrollRow = 10
End Sub

Open in new window


to this. Otherwise the "Formula" cell (A2) gets blanked out when the workbook opens.
Private Sub Workbook_Open()

Dim intIndex As Integer

With Worksheets("Menu")
    For intIndex = 10 To .UsedRange.Rows.Count
        .Cells(intIndex, 1).Value = ""
    Next
End With
ActiveWindow.ScrollRow = 10
End Sub

Open in new window

0
Frank FreeseAuthor Commented:
Thanks
0
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.