Names of Sheets and Charts in Workbook

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

Would like to find the Nanes of all the Worksheets and Chart Sheets within Workbook

Thank
 
Try something like the following:

Dim SH As Object
For Each SH In ThisWorkbook.Sheets
Debug.Print SH.Name
Next SH

This will also list Excel4 macro sheet and Excel5 module sheets,
but it is very unlikely that you would have these in any workbook
created in Excel 97 or later.
 
Hi Sonny,

You can loop through the Sheets collection to do this:

Sub test()
Dim sht As Object

For Each sht In ActiveWorkbook.Sheets
Debug.Print sht.Name & " (Type: " & IIf(sht.Type = _
xlWorksheet, "Worksheet", "Chart") & ")"
Next sht
End Sub

There are a few other types of sheets, so the IIf statement will only work
if you are only concerned with Worksheets and Chart sheets.

--
Regards,

Jake Marx
MS MVP - Excel
www.longhead.com

[please keep replies in the newsgroup - email address unmonitored]
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top