View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.misc
Barb Reinhardt Barb Reinhardt is offline
external usenet poster
 
Posts: 3,355
Default How do I print worksheet tabs names from exel 2003

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




"Plinius" wrote:

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.