How do I print worksheet tabs names from exel 2003

P

Plinius

I have a workbook with a lot of worksheets and I would like to print a list
of all these worksheet names, as at last count it was over 200 of them.
 
B

Barb Reinhardt

Here's a quck and dirty macro. I know I've seen another posted on line, but
can't find it now.

To get to the VBA editor, type ALT F11
Then display the project explorer with CTRL R.
Add a module using Insert Module
and paste this into the module.

Sub worksheetname()
Dim aWB As Workbook
Dim aws As Worksheet

Set aWB = ActiveWorkbook

Worksheets.Add.Name = "WorksheetList"
Set aws = ActiveSheet
Debug.Print aWB.Sheets.Count
lrow = 1
For sht = 1 To aWB.Sheets.Count
If aWB.Sheets(sht).Name <> aws.Name Then
lrow = lrow + 1
Debug.Print aWB.Sheets(sht).Name
aws.Cells(lrow, 1).Value = aWB.Sheets(sht).Name
End If
Next sht

End Sub
 
Top