Home |
Search |
Today's Posts |
|
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
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.programming
|
|||
|
|||
![]()
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? |
#3
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
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? |
#4
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
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? |
#5
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
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? |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
How to count number of sheets | Excel Worksheet Functions | |||
Count number of sheets | Excel Discussion (Misc queries) | |||
Count number of sheets | Excel Worksheet Functions | |||
Count number of sheets | Excel Discussion (Misc queries) | |||
Count the number of sheets. | Excel Discussion (Misc queries) |