ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Discussion (Misc queries) (https://www.excelbanter.com/excel-discussion-misc-queries/)
-   -   How do I print worksheet tabs names from exel 2003 (https://www.excelbanter.com/excel-discussion-misc-queries/116789-how-do-i-print-worksheet-tabs-names-exel-2003-a.html)

Plinius

How do I print worksheet tabs names from exel 2003
 
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.

Barb Reinhardt

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.


Smigielski

Printing worksheets tabs names
 
Excellent instructions! Very simple and easy to follow.

Thank you very much for your help.
Margi

EggHeadCafe.com - .NET Developer Portal of Choice
http://www.eggheadcafe.com

Plinius

How do I print worksheet tabs names from exel 2003
 
Hi Barb

Thank you for your time and advice. Most helpful.

"Barb Reinhardt" wrote:

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.



All times are GMT +1. The time now is 07:57 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
ExcelBanter.com