Counting the number of Worksheets in a Workbook

  • Thread starter Bill from Holland Michigan
  • Start date
B

Bill from Holland Michigan

I want to show how many sheets I have in a workbook using a formula. The
number changes everyday. What do I use, or can I even do this?
 
G

Gary L Brown

This user defined function will do it...

Public Function WksCount() As Integer
WksCount = Application.Worksheets.Count
End Function

HTH,
 
K

Ken Johnson

Gary said:
This user defined function will do it...

Public Function WksCount() As Integer
WksCount = Application.Worksheets.Count
End Function

HTH,

If any of your sheets are not worksheets (eg chart sheets, xl4macro
sheets) then you should use...

Public Function ShtCount() As Integer
ShtCount = Application.Sheets.Count
End Function

Ken Johnson
 
Top