Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 1
Default Command to count number of worksheets in a workbook?

I am setting up a workbook to contain information on expenditure on events.
For each event there will be a worksheet detailing expenditure, which will
also act as a form for the expenditure to be authorised. The number of
worksheets will vary depending on the number of events held each month (i.e.
if there are 10 events in the month there will be 10 corresponding
worksheets). The data on these worksheets will be transferred onto a summary
sheet - one row per event. Rather than estimating the number of events per
month (and therefore the number of worksheets) and hardcoding the formulas
into the summary sheet, is there a command within excel that can count the
number of worksheets in the workbook so I can use the result to then populate
the summary page?
  #2   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 11,058
Default Command to count number of worksheets in a workbook?

Try this tiny UDF:

Function worksheetcount()
worksheetcount = Worksheets.Count
End Function
--
Gary's Student


"Saul Fowler" wrote:

I am setting up a workbook to contain information on expenditure on events.
For each event there will be a worksheet detailing expenditure, which will
also act as a form for the expenditure to be authorised. The number of
worksheets will vary depending on the number of events held each month (i.e.
if there are 10 events in the month there will be 10 corresponding
worksheets). The data on these worksheets will be transferred onto a summary
sheet - one row per event. Rather than estimating the number of events per
month (and therefore the number of worksheets) and hardcoding the formulas
into the summary sheet, is there a command within excel that can count the
number of worksheets in the workbook so I can use the result to then populate
the summary page?

  #3   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 2
Default Command to count number of worksheets in a workbook?

Hello

I'm not used to UDF, how does it work? I read that UDF should be created in
VBA module and that I have done, but how do I call it in workbook?

I have been fighting with this same worksheetcount problem for quite some
time...


"Gary''s Student" wrote:

Try this tiny UDF:

Function worksheetcount()
worksheetcount = Worksheets.Count
End Function
--
Gary's Student


"Saul Fowler" wrote:

I am setting up a workbook to contain information on expenditure on events.
For each event there will be a worksheet detailing expenditure, which will
also act as a form for the expenditure to be authorised. The number of
worksheets will vary depending on the number of events held each month (i.e.
if there are 10 events in the month there will be 10 corresponding
worksheets). The data on these worksheets will be transferred onto a summary
sheet - one row per event. Rather than estimating the number of events per
month (and therefore the number of worksheets) and hardcoding the formulas
into the summary sheet, is there a command within excel that can count the
number of worksheets in the workbook so I can use the result to then populate
the summary page?

  #4   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 2
Default Command to count number of worksheets in a workbook?

Hi
I found the way to use UDFs just by luck, it was easier than I thought.
Now my workbook works like a dream :)
Thanks for this tiny UDF

"tuusis" wrote:

Hello

I'm not used to UDF, how does it work? I read that UDF should be created in
VBA module and that I have done, but how do I call it in workbook?

I have been fighting with this same worksheetcount problem for quite some
time...


"Gary''s Student" wrote:

Try this tiny UDF:

Function worksheetcount()
worksheetcount = Worksheets.Count
End Function
--
Gary's Student


"Saul Fowler" wrote:

I am setting up a workbook to contain information on expenditure on events.
For each event there will be a worksheet detailing expenditure, which will
also act as a form for the expenditure to be authorised. The number of
worksheets will vary depending on the number of events held each month (i.e.
if there are 10 events in the month there will be 10 corresponding
worksheets). The data on these worksheets will be transferred onto a summary
sheet - one row per event. Rather than estimating the number of events per
month (and therefore the number of worksheets) and hardcoding the formulas
into the summary sheet, is there a command within excel that can count the
number of worksheets in the workbook so I can use the result to then populate
the summary page?

Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
HOW DO I FORMAT WORKSHEETS IN A WORKBOOK TO NUMBER IN A SEQUENCE? Lee S Excel Worksheet Functions 1 May 14th 06 05:20 AM
Copy Worksheets from one Workbook to Another halem2 Excel Worksheet Functions 3 March 25th 06 06:04 AM
Some worksheets not viewable within a workbook on a particular PC Rob Excel Discussion (Misc queries) 3 February 23rd 06 06:00 PM
Count Number of Characters in a cell? AHJuncti Excel Discussion (Misc queries) 2 June 16th 05 07:39 PM
Count number of shaded cells Maddoktor Excel Discussion (Misc queries) 2 December 20th 04 08:35 PM


All times are GMT +1. The time now is 04:27 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"