![]() |
Count sheets in workbook
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 "SS" wrote: Is there a way to count the sheets in a workbook without doing it manually? Cheers Shona |
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 |
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 |
All times are GMT +1. The time now is 04:06 AM. |
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com