Results 1 to 5 of 5
  1. #1
    2 Star Lounger
    Join Date
    Sep 2001
    Location
    California
    Posts
    106
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Count Worksheets (97 & 2000)

    How can I easily find out how many worksheets are in a workbook?
    Thanks,
    Caroline in lala-land

  2. #2
    Super Moderator
    Join Date
    Dec 2000
    Location
    Salt Lake City, Utah, USA
    Posts
    9,507
    Thanks
    0
    Thanked 4 Times in 4 Posts

    Re: Count Worksheets (97 & 2000)

    Open the VBE and in the Immediates window enter

    ?ThisWorkbook.Worksheets.Count

    and press enter.

    I was looking for a formula, but =COUNTBLANK() isn't 3D.
    -John ... I float in liquid gardens
    [acronym title="Gday mate!"][/acronym] [acronym title="What up Dude?"][/acronym] UTC -7±DS

  3. #3
    Uranium Lounger
    Join Date
    Jan 2001
    Location
    South Carolina, USA
    Posts
    7,295
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Count Worksheets (97 & 2000)

    The following User Defined Function will return the number of worksheets in the activeworkbook (does not include other kinds of sheets like chart sheets). However, Excel does not consider inserting a new worksheet a recalculate event. Therefore, the count will not update after inserting a new worksheet until some other change is made that causes a recalculate event.


    <pre>Public Function NumSheets() As Integer
    Application.Volatile
    NumSheets = ActiveWorkbook.Worksheets.Count
    End Function
    </pre>

    Legare Coleman

  4. #4
    2 Star Lounger
    Join Date
    Jan 2001
    Location
    Perth, Western Australia, Australia
    Posts
    189
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Count Worksheets (97 & 2000)

    This thread may be of use..

  5. #5
    WS Lounge VIP rory's Avatar
    Join Date
    Dec 2000
    Location
    Burwash, East Sussex, United Kingdom
    Posts
    5,910
    Thanks
    0
    Thanked 89 Times in 85 Posts

    Re: Count Worksheets (97 & 2000)

    Just as an alternative to the other suggestions, choose Insert-Name-Define, choose a name (e.g. SheetCount) and in the refers to box type:
    =GET.WORKBOOK(4)
    then in any cell in your workbook you can use =sheetcount.
    Note that this has the same drawback that Legare mentioned with his VBA solution.
    Regards,
    Rory
    Microsoft MVP - Excel.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •