Returns the number of sheets


* For instructions on how to add a function to a workbook refer to the page under Inserting Functions
* The equivalent JavaScript function is WORKSHEETSCOUNT

'bIncludeChartSheets - Whether to include chart sheets in the total.

Public Function WORKSHEETSCOUNT(Optional ByVal bIncludeChartSheets As Boolean = True) As Integer

   If bIncludeChartSheets = True Then
      WORKSHEETSCOUNT = Application.ActiveWorkbook.Sheets.Count
      WORKSHEETSCOUNT = Application.ActiveWorkbook.Worksheets.Count
   End If

End Function

You can use the built-in worksheet function SHEETS() in Excel 2013 to return the number of sheets in the active workbook.


In Power Utility Pack this function is called SHEETCOUNT

© 2022 Better Solutions Limited. All Rights Reserved. © 2022 Better Solutions Limited TopPrevNext