![]() |
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
One way:
Public Function NumberOfSheets(Optional ByRef wb As Workbook) As Long If wb Is Nothing Then Set wb = ActiveWorkbook NumberOfSheets = wb.Sheets.Count End Function Example: Dim wbParticular As Workbook Set wbParticular = Workbooks("Particular.xls") MsgBox "Workbook " & vbNewLine & vbNewLine & " " & _ wbParticular.Name & vbNewLine & vbNewLine & _ "has " & NumberOfSheets(wbParticular) & " sheets." In article . com, 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
NumberofSheets = ThisWorkbook.Worksheets.Count
-- If this posting was helpful, please click on the Yes button. Regards, Michael Arch. "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
once again check your other posts. One post is enough to get a question
answered. "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
or if there are chartsheets as well
Activeworkbook.Sheets.count -- regards, Tom Ogilvy "Michael" wrote: NumberofSheets = ThisWorkbook.Worksheets.Count -- If this posting was helpful, please click on the Yes button. Regards, Michael Arch. "tc" wrote: Hi. I want to create a macro that will count the number of sheets in a particular workbook. Is this possible? |
All times are GMT +1. The time now is 03:39 PM. |
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com