Link to home
Start Free TrialLog in
Avatar of Frank Freese
Frank FreeseFlag for United States of America

asked on

Print out sheets names

Folks,
I would like to print out my worksheets names from a workbook.
.
ASKER CERTIFIED SOLUTION
Avatar of Martin Liss
Martin Liss
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
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?
Avatar of Frank Freese

ASKER

thanks again
You are appreciated
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

You're welcome.
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

Thanks