View Single Post
  #4   Report Post  
Posted to microsoft.public.excel.misc
JE McGimpsey JE McGimpsey is offline
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