+ Reply to Thread
Results 1 to 4 of 4

Counting sheets in a workbook

Hybrid View

  1. #1
    Registered User
    Join Date
    03-03-2022
    Location
    Hendersonville, NC
    MS-Off Ver
    2016-2021
    Posts
    1

    Question Counting sheets in a workbook

    Looking to count sheets in a workbook, subtracting 1 from the total in VBA.

  2. #2
    Forum Expert Pepe Le Mokko's Avatar
    Join Date
    05-14-2009
    Location
    Belgium
    MS-Off Ver
    O365 v 2504
    Posts
    13,627

    Re: Counting sheets in a workbook

    Hi and welcome
    Perhaps https://www.automateexcel.com/how-to/count-worksheets/

  3. #3
    Forum Moderator davesexcel's Avatar
    Join Date
    02-19-2006
    Location
    Regina
    MS-Off Ver
    MS 365
    Posts
    13,525

    Re: Counting sheets in a workbook

    Dim x As Long, y As Long
    x = Sheets.Count
    y = x - 1
    MsgBox (x & " Sheets")
    MsgBox (y & " Total sheets less 1")

  4. #4
    Registered User
    Join Date
    03-05-2025
    Location
    Deutschland
    MS-Off Ver
    MS Office Home & Business 2024
    Posts
    125

    Re: Counting sheets in a workbook

    Hi,

    like this:
    Sub test()
    nr = ThisWorkbook.Sheets.Count - 1
    MsgBox nr
    End Sub

    BR, Alexandra

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. [SOLVED] [GOOGLE SHEETS] Counting Occurrence in Conjunction with Name on Multiple Sheets
    By theexcelnovice123 in forum For Other Platforms(Mac, Google Docs, Mobile OS etc)
    Replies: 6
    Last Post: 11-04-2021, 01:38 PM
  2. [SOLVED] Autofilter in Multiple sheets - copy sheets to new workbook - save workbook with a field
    By anchuri_chaitanya in forum Excel Programming / VBA / Macros
    Replies: 15
    Last Post: 03-21-2021, 01:30 AM
  3. Replies: 1
    Last Post: 10-04-2013, 04:21 AM
  4. [SOLVED] Macro to copy cells from multiple sheets in workbook to multiple sheets in other workbook
    By KeithMale in forum Excel Programming / VBA / Macros
    Replies: 6
    Last Post: 06-13-2013, 05:37 PM
  5. Replies: 2
    Last Post: 10-07-2012, 12:42 PM
  6. Automatically Copy sheets in one workbook to create sheets in a new workbook..
    By leebarratt in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 10-13-2011, 03:14 AM
  7. Macro for filter on protected workbook that works for all sheets, no matter what sheets are named?
    By StargateFanFromWork in forum Excel Programming / VBA / Macros
    Replies: 6
    Last Post: 01-26-2006, 02:35 PM

Tags for this Thread

Bookmarks

Posting Permissions

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

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1