ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Workbook property telling number of sheets (https://www.excelbanter.com/excel-programming/319605-workbook-property-telling-number-sheets.html)

[email protected]

Workbook property telling number of sheets
 
Gentlemen and ladies,

Does anyone know of a way to obtain in VB the number of sheets that
exist in a given workbook?


JE McGimpsey

Workbook property telling number of sheets
 
One way:

nNumSheets = Workbooks("Workbook1.xls").Worksheets.Count


In article .com,
wrote:

Does anyone know of a way to obtain in VB the number of sheets that
exist in a given workbook?


Paul B

Workbook property telling number of sheets
 
Michael, use Sheets.Count something like this
Sub sheetcount()
MsgBox "There Are " & Sheets.Count & " Sheet(s) in this workbook"
End Sub


--
Paul B
Always backup your data before trying something new
Please post any response to the newsgroups so others can benefit from it
Feedback on answers is always appreciated!
Using Excel 2002 & 2003

wrote in message
oups.com...
Gentlemen and ladies,

Does anyone know of a way to obtain in VB the number of sheets that
exist in a given workbook?




[email protected]

Workbook property telling number of sheets
 
Excellent. I am very grateful for your expertise.


[email protected]

Workbook property telling number of sheets
 
Excellent. I am very grateful for your expertise.



All times are GMT +1. The time now is 01:10 PM.

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