Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.misc
tc tc is offline
external usenet poster
 
Posts: 40
Default Count number of sheets

Hi. I want to create a macro that will count the number of sheets in a
particular workbook. Is this possible?

  #2   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 11,501
Default Count number of sheets

Check your other post

"tc" wrote:

Hi. I want to create a macro that will count the number of sheets in a
particular workbook. Is this possible?


  #3   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 11,058
Default Count number of sheets

Try this:

Sub sheet_counter()
Dim whichbook As String
whichbook = Application.InputBox("enter workbook name" & Chr(10) & "for
example: Book2")
For Each wb In Workbooks
If whichbook = wb.Name Then
MsgBox (wb.Worksheets.Count)
Exit Sub
End If
Next
MsgBox ("workbook: " & whichbook & " is not currently opened" _
& Chr(10) & "please open and then re-run this macro")

End Sub

--
Gary''s Student - gsnu2007


"tc" wrote:

Hi. I want to create a macro that will count the number of sheets in a
particular workbook. Is this possible?


  #4   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 4,624
Default Count number of sheets

Still only counts worksheets.

(May be what the OP wants, of course...)

In article ,
Gary''s Student wrote:

Sub sheet_counter()
Dim whichbook As String
whichbook = Application.InputBox("enter workbook name" & Chr(10) & "for
example: Book2")
For Each wb In Workbooks
If whichbook = wb.Name Then
MsgBox (wb.Worksheets.Count)
Exit Sub
End If
Next
MsgBox ("workbook: " & whichbook & " is not currently opened" _
& Chr(10) & "please open and then re-run this macro")

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
Count number of sheets JHL Excel Discussion (Misc queries) 3 September 6th 07 09:06 PM
How can I count number of sheets present in a workbook? Imran Excel Discussion (Misc queries) 1 October 6th 06 11:06 AM
Count rows and insert number to count them. Mex Excel Discussion (Misc queries) 6 August 23rd 06 02:29 AM
Count the number of sheets. Olle Svensson Excel Discussion (Misc queries) 3 March 13th 06 02:30 PM
Number count - postcodes and need to count the numbers of tim... Mark - Aust Excel Discussion (Misc queries) 1 October 24th 05 10:00 AM


All times are GMT +1. The time now is 07:05 AM.

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"