ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Discussion (Misc queries) (https://www.excelbanter.com/excel-discussion-misc-queries/)
-   -   Count sheets (https://www.excelbanter.com/excel-discussion-misc-queries/227303-count-sheets.html)

Dale[_5_]

Count sheets
 
Hi, is there a way I could display how many sheets I have in a workbook

Thanks

Jarek Kujawa[_2_]

Count sheets
 
use this code/function:

Function sheet_count() As Integer
sheet_count = ThisWorkbook.Sheets.Count
End Function

press ALT+F11 to open Microsoft Visual Basic window
click Insert-Module
paste the code there

then in any cell insert:
=sheet_count()

ATTENTION: the function ALL sheets in the workbook, including chart
sheets and hidden sheets

pls click YES if this post was helpful


On 10 Kwi, 11:48, "Dale" wrote:
Hi, is there a way I could display how many sheets I have in a workbook

Thanks



Gary''s Student

Count sheets
 
Try this udf:

Function sheetcount() As Long
sheetcount = Sheets.Count
End Function

--
Gary''s Student - gsnu200845


"Dale" wrote:

Hi, is there a way I could display how many sheets I have in a workbook

Thanks



All times are GMT +1. The time now is 01:47 AM.

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