Name and number of sheets

  • Thread starter Thread starter MB
  • Start date Start date
M

MB

Could someone please post the code that will count the
number of sheets in a workbook and get each sheet name. I
thought I could use the for statement after I got the
number of sheets, but can't seem to get that number.

Thank you
 
Maybe something like:

Option Explicit
Sub testme()

Dim wks As Worksheet

MsgBox Sheets.Count
MsgBox Worksheets.Count

For Each wks In ActiveWorkbook.Worksheets
MsgBox wks.Name
Next wks
End Sub

Worksheets.count may not equal sheets.count (if you have chart sheets for
example).
 

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