![]() |
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? |
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? |
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? |
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 |
All times are GMT +1. The time now is 10:17 PM. |
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com