Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 80
Default Number of Worksheets in a Workbook

Is there a way to write a function that will return the worksheet count to
the user on demand? I know worksheets.count will return the number in VBA -
but how do I make it a function to show the number when needed by the user?
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 10,593
Default Number of Worksheets in a Workbook

Write a UDF


Function NumSheets()
NumSheets = Worksheets.Count
End Function

and use that


--
HTH

Bob

(there's no email, no snail mail, but somewhere should be gmail in my addy)

"Dawn" wrote in message
...
Is there a way to write a function that will return the worksheet count to
the user on demand? I know worksheets.count will return the number in
VBA -
but how do I make it a function to show the number when needed by the
user?



  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 791
Default Number of Worksheets in a Workbook

Attach it to a button then button will the do the following

p=Worksheets.Count

Msgbox(p)


--
If this posting was helpful, please click on the Yes button.
Regards,

Michael Arch.




"Dawn" wrote:

Is there a way to write a function that will return the worksheet count to
the user on demand? I know worksheets.count will return the number in VBA -
but how do I make it a function to show the number when needed by the user?

  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 9,101
Default Number of Worksheets in a Workbook

call with =numbersheets()

Function numbersheets()

numbersheets = Worksheets.Count
End Function

I would recommend the info function but instead of returning 3 worksheets,
it is returning 6. I not going to tell you to use something that gives a
wrong answer.
=INFO("numfile")




"Dawn" wrote:

Is there a way to write a function that will return the worksheet count to
the user on demand? I know worksheets.count will return the number in VBA -
but how do I make it a function to show the number when needed by the user?

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
Is there a maximum of the number of worksheets in a workbook? CYNTHIA Excel Discussion (Misc queries) 6 December 18th 07 02:46 PM
number worksheets in workbook sherobot Excel Discussion (Misc queries) 1 February 14th 07 09:21 PM
Counting the number of Worksheets in a Workbook Bill from Holland Michigan Excel Worksheet Functions 2 October 13th 06 12:14 AM
Max number of worksheets in a workbook? deko[_3_] Excel Programming 13 June 22nd 05 05:41 PM
Add Workbook with specific number of worksheets Linda Mac Excel Programming 4 June 2nd 04 09:11 PM


All times are GMT +1. The time now is 12:28 AM.

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

About Us

"It's about Microsoft Excel"