ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Discussion (Misc queries) (https://www.excelbanter.com/excel-discussion-misc-queries/)
-   -   count no of worksheet (https://www.excelbanter.com/excel-discussion-misc-queries/39633-count-no-worksheet.html)

Ankur

count no of worksheet
 
is there any command to count the total no of worksheets in a file

Bob Phillips

ACtiveworkbook.Worksheets.Count

--
HTH

Bob Phillips

"Ankur" wrote in message
...
is there any command to count the total no of worksheets in a file




Ankur

i am not able to do that can u please explain in detail......thanks for your
help

"Bob Phillips" wrote:

ACtiveworkbook.Worksheets.Count

--
HTH

Bob Phillips

"Ankur" wrote in message
...
is there any command to count the total no of worksheets in a file





Bob Phillips

This is VBA, so you need to go to the VB IDE (Alt-F11) and then either
- add it to a macro that you are writing
OR
- create a UDF that returns it if you want it in a worksheet function

Function NumSheets()
NumSheets = Application.Caller.Parent.Parent.Worksheets.Count
End Function


and add
=NumSheets()
in your worksheet

--
HTH

Bob Phillips

"Ankur" wrote in message
...
i am not able to do that can u please explain in detail......thanks for

your
help

"Bob Phillips" wrote:

ACtiveworkbook.Worksheets.Count

--
HTH

Bob Phillips

"Ankur" wrote in message
...
is there any command to count the total no of worksheets in a file








All times are GMT +1. The time now is 04:25 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com