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 |
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 |
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/ |
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/ |
VBA- Counting the number of the sheets
|
All times are GMT +1. The time now is 02:17 AM. |
Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
ExcelBanter.com