Count sheets in workbook

  • Thread starter Thread starter SS
  • Start date Start date
S

SS

Is there a way to count the sheets in a workbook without doing it manually?

Cheers
Shona
 
This macro should do it:

Sub shtcount()
MsgBox "# of sheets: " & Sheets.Count
End Sub

Regards
Rowan
 
Shona, here is one way,

Sub Count_WorkSheets()
Dim c As Integer
c = ActiveWorkbook.Sheets.Count
MsgBox "There are " & c & " Sheet(s)"
End Sub

If you are new to Macros have a look here on getting started with macros
http://www.mvps.org/dmcritchie/excel/getstarted.htm


--
Paul B
Always backup your data before trying something new
Please post any response to the newsgroups so others can benefit from it
Feedback on answers is always appreciated!
Using Excel 2002 & 2003
 

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