VBA- Counting the number of the sheets

T

Timse

Hi,

I’m trying to write a macro which could count the number of the sheet
in the workbook. I need this for a condition in my do-loop circle. Th
number of the sheets is variable.

If somebody could help me and tell me a way to do this I would be ver
pleased.


Thanks,

-Tims
 
B

Binzelli

Timse,

these two should do the job:

Activeworkbook.Sheets.Count

OR

Workbooks("name").Sheets.Count

Good luc
 
D

Dick Kusleika

Timse

ActiveWorkbook.Sheets.Count

will count all the sheets (worksheets, charts, etc.)

ActiveWorkbook.Worksheets.Count

just the worksheets.
 
Top