COUNTSHEETS

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


Remarks

* For instructions on how to add a function to a workbook refer to the page under Inserting Functions


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

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

End Function

Migration

In Power Utility Pack this function is called SHEETCOUNT


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