ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   VBA- Counting the number of the sheets (https://www.excelbanter.com/excel-programming/302108-vba-counting-number-sheets.html)

Timse[_4_]

VBA- Counting the number of the sheets
 
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

--
Message posted from http://www.ExcelForum.com


Binzelli[_4_]

VBA- Counting the number of the sheets
 
Timse,

these two should do the job:

Activeworkbook.Sheets.Count

OR

Workbooks("name").Sheets.Count

Good luc

--
Message posted from http://www.ExcelForum.com


Nikos Yannacopoulos[_5_]

VBA- Counting the number of the sheets
 
Timse,

Worksheets.Count will return the number.

HTH,
Nikos

"Timse " wrote in message
...
Hi,

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

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


Thanks,

-Timse


---
Message posted from http://www.ExcelForum.com/




Dick Kusleika[_3_]

VBA- Counting the number of the sheets
 
Timse

ActiveWorkbook.Sheets.Count

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

ActiveWorkbook.Worksheets.Count

just the worksheets.

--
Dick Kusleika
MVP - Excel
Excel Blog - Daily Dose of Excel
www.dicks-blog.com

"Timse " wrote in message
...
Hi,

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

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


Thanks,

-Timse


---
Message posted from http://www.ExcelForum.com/




Timse[_5_]

VBA- Counting the number of the sheets
 
Thank you all!

This really helped me!

-Tims

--
Message posted from http://www.ExcelForum.com



All times are GMT +1. The time now is 02:17 AM.

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