Home |
Search |
Today's Posts |
#1
![]()
Posted to microsoft.public.excel.misc
|
|||
|
|||
![]()
Hi. I want to create a macro that will count the number of sheets in a
particular workbook. Is this possible? |
#2
![]()
Posted to microsoft.public.excel.misc
|
|||
|
|||
![]()
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
![]()
Posted to microsoft.public.excel.misc
|
|||
|
|||
![]()
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
![]()
Posted to microsoft.public.excel.misc
|
|||
|
|||
![]()
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 |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
Count number of sheets | Excel Discussion (Misc queries) | |||
How can I count number of sheets present in a workbook? | Excel Discussion (Misc queries) | |||
Count rows and insert number to count them. | Excel Discussion (Misc queries) | |||
Count the number of sheets. | Excel Discussion (Misc queries) | |||
Number count - postcodes and need to count the numbers of tim... | Excel Discussion (Misc queries) |