Gord is showing you a VBA subroutine that will do the trick. I'm not
Many thanks but it's sounding a bit beyond my capabilities. I'll just
count the sheets!
Try the following... From any worksheet, press Alt+F11; this will take you
to the VBA editor. Click Insert/Module on the VBA editor's menubar. A code
window will popup that has the title "Book 1 - Module1 (Code)"... copy the
following three lines of code (note that it is slightly different than what
Gord posted) and paste them into that code window
Function CountSheets()
CountSheets = ActiveWorkbook.Sheets.Count
End Function
Now, go back to the worksheet (you can close the VBA editor if you want; the
code you just copied into it will be saved when you save the workbook); type
this into any cell...
=CountSheets()
and press Enter. You should see a count of the number of sheets in your
workbook. You can use CountSheets() inside any formulas you create (in this
workbook) just like it was a regular built-in spreadsheet function.
Rick