How to count number of worksheets in an Excel file

← PrevNext →

You can use the SHEETS() function in Excel to find the total number of worksheets in an Excel file. Alternatively, you can use a simple macro to get the total count (or number) of sheets.

Count total sheets using a formula

You can use this built-in function to get the total number of sheets in your workbook.

=SHEETS()

Simply enter the =SHEETS() function in any cell and press the "Enter" key. Do not assign any argument (or parameter) to the function. It will "return" the total number of sheets in the Excel file (or workbook), including hidden sheets.

Count sheets in Excel using VBA

Write this code in a module and press F5.

Sub sheetCount()
    Debug.Print (Sheets.Count)   ' Press Ctrl + g to open the debug window and see the output.
End Sub

← PreviousNext →