Can one print a list of worksheet tab labels contained in a workb.

K

Kelroy D B

Is it possible to print a list of the tab labels contained within an Excel
workbook. If so, how?
 
J

Jason Morin

You can list the worksheet names in a new sheet and then
print the list from there:

Sub ListWSNames()
Dim sh As Worksheet
Dim i As Long

With ActiveWorkbook
.Worksheets(1).Select
Set sh = .Worksheets.Add
End With

With sh
For i = 2 To ActiveWorkbook.Worksheets.Count
.Cells(i, "A").Value = Worksheets(i).Name
Next i
.Cells(1, "A").Value = "Sheet " & _
"Names (excl. this one)"
End With

Range("A:A").EntireColumn.AutoFit

End Sub
 
Top