Ads

How to count the number of worksheets used in an MS Excel file


Assuming I have a number of workbooks with a large number of worksheets filled out (not by me) in each workbook. Do you know how to count the number of worksheets used ?

Well you wouldn't be interested in manually counting by clicking each worksheet ?
Yes there is a way! A much easier than using the VB code;

Here we go;
We use Excel in built formula:

=COUNTA('*'!A1)+1

... where assuming A1 in each sheet is non-blank.

Example:

1. Suppose I have an xls file with 100 sheets:
2. I choose cell B2 and place my formula in it.







3. Press the followin gkeys: Ctrl+Shift+Enter

4. You get the answer as 100 in the cell B2