Counting the number of Worksheets in a Workbook

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

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?
 
This user defined function will do it...

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

HTH,
 
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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top