Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
SS
 
Posts: n/a
Default Count sheets in workbook

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

Cheers
Shona


  #2   Report Post  
Rowan
 
Posts: n/a
Default

This macro should do it:

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

Regards
Rowan

"SS" wrote:

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

Cheers
Shona



  #3   Report Post  
Paul B
 
Posts: n/a
Default

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

"SS" wrote in message
...
Is there a way to count the sheets in a workbook without doing it

manually?

Cheers
Shona




  #4   Report Post  
SS
 
Posts: n/a
Default

Excellent thanks much quicker than than the way I thought of

Cheers Shona
"Paul B" wrote in message
...
Shona, here is one way,

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




Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
excel should have a function to count sheets carlos sosa Excel Worksheet Functions 7 April 24th 05 08:29 PM
Numbering sheets in workbook Red Excel Worksheet Functions 3 March 2nd 05 08:10 PM
Automatically copy selective sheets from one workbook to another Ann Excel Discussion (Misc queries) 0 March 1st 05 07:09 PM
How to hyperlink from a workbook to sheets in another workbook? MJOHNSON Excel Worksheet Functions 0 February 17th 05 08:31 PM
Copy comments to several sheets in a workbook? jen_l_333 Excel Worksheet Functions 1 January 7th 05 10:30 PM


All times are GMT +1. The time now is 01:12 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"