+ Reply to Thread
Results 1 to 15 of 15

Count all used rows in select worksheets

  1. #1
    Forum Contributor
    Join Date
    02-10-2012
    Location
    Newcastle upon Tyne
    MS-Off Ver
    Excel 2021
    Posts
    114

    Count all used rows in select worksheets

    Hi,

    I'm looking for a MsgBox that will tell me how many used rows there are in an array of selected worksheets, ignoring the first row...?

    Regards

    Colin

  2. #2
    Forum Guru TMS's Avatar
    Join Date
    07-15-2010
    Location
    The Great City of Manchester, NW England ;-)
    MS-Off Ver
    MSO 2007,2010,365
    Posts
    48,311

    Re: Count all used rows in select worksheets

    Fast answers need visual help. Please read the yellow banner at the top of this page on how to attach a file.
    Trevor Shuttleworth - Retired Excel/VBA Consultant

    I dream of a better world where chickens can cross the road without having their motives questioned

    'Being unapologetic means never having to say you're sorry' John Cooper Clarke


  3. #3
    Forum Contributor
    Join Date
    02-10-2012
    Location
    Newcastle upon Tyne
    MS-Off Ver
    Excel 2021
    Posts
    114

    Re: Count all used rows in select worksheets

    See attached...

    the answer would be 18 - count of all used rows in column A in all worksheets excluding header
    Attached Files Attached Files

  4. #4
    Valued Forum Contributor
    Join Date
    06-27-2010
    Location
    sYRIA
    MS-Off Ver
    Excel 2013
    Posts
    669

    Re: Count all used rows in select worksheets

    Hi
    Try
    Please Login or Register  to view this content.

  5. #5
    Forum Contributor
    Join Date
    02-10-2012
    Location
    Newcastle upon Tyne
    MS-Off Ver
    Excel 2021
    Posts
    114

    Re: Count all used rows in select worksheets

    That works perfect... is it possible to ignore the first 2 worksheets?

    Also to provide a total of the values in column D on the same msgbox?

  6. #6
    Forum Contributor
    Join Date
    02-10-2012
    Location
    Newcastle upon Tyne
    MS-Off Ver
    Excel 2021
    Posts
    114

    Re: Count all used rows in select worksheets

    So i've amended the above to only look at sheets 3 onwards... it's just the total of the values in column D?

  7. #7
    Forum Guru TMS's Avatar
    Join Date
    07-15-2010
    Location
    The Great City of Manchester, NW England ;-)
    MS-Off Ver
    MSO 2007,2010,365
    Posts
    48,311

    Re: Count all used rows in select worksheets

    So, you said your expected result is 18. In your example, that's three cells in column A on each of six sheets.

    Now your requirement is to count cells in column D on sheets 3 onwards. There is no data in column D on any of the sheets.

    And you also need to be aware that moving the sheets around could affect the results.

    Do the sheets have names, other than Sheet1, Sheet2, Sheet3, etc. It would be safer if the code referred to specific named sheets.

  8. #8
    Valued Forum Contributor
    Join Date
    06-27-2010
    Location
    sYRIA
    MS-Off Ver
    Excel 2013
    Posts
    669

    Re: Count all used rows in select worksheets

    Please Login or Register  to view this content.

  9. #9
    Forum Contributor
    Join Date
    02-10-2012
    Location
    Newcastle upon Tyne
    MS-Off Ver
    Excel 2021
    Posts
    114

    Re: Count all used rows in select worksheets

    Sorry, revised workbook attached... sum of column B, not D.

    So in this case it would be 18 and 36

    The worksheets will not move so that should be ok, thanks..
    Attached Files Attached Files

  10. #10
    Forum Expert
    Join Date
    03-28-2012
    Location
    TBA
    MS-Off Ver
    Office 365
    Posts
    12,454

    Re: Count all used rows in select worksheets

    Do you want to count the number of cells or add the cells in column B ?

  11. #11
    Forum Contributor
    Join Date
    02-10-2012
    Location
    Newcastle upon Tyne
    MS-Off Ver
    Excel 2021
    Posts
    114

    Re: Count all used rows in select worksheets

    the sum of the values...

  12. #12
    Forum Guru TMS's Avatar
    Join Date
    07-15-2010
    Location
    The Great City of Manchester, NW England ;-)
    MS-Off Ver
    MSO 2007,2010,365
    Posts
    48,311

    Re: Count all used rows in select worksheets

    4 sheets, 3 cells in column B each is 12. If you are summing the values, rather than counting them, it's 24.

    Has your requirement changed again?

  13. #13
    Forum Contributor
    Join Date
    02-10-2012
    Location
    Newcastle upon Tyne
    MS-Off Ver
    Excel 2021
    Posts
    114

    Re: Count all used rows in select worksheets

    there are 6 sheets with three rows each containing the value 2 (6*3*2) = 36?

  14. #14
    Forum Expert
    Join Date
    03-28-2012
    Location
    TBA
    MS-Off Ver
    Office 365
    Posts
    12,454

    Re: Count all used rows in select worksheets

    It is Mohadin's code— I do not take the credit just twicked it.

    Please Login or Register  to view this content.

  15. #15
    Forum Guru TMS's Avatar
    Join Date
    07-15-2010
    Location
    The Great City of Manchester, NW England ;-)
    MS-Off Ver
    MSO 2007,2010,365
    Posts
    48,311

    Re: Count all used rows in select worksheets

    there are 6 sheets with three rows each containing the value 2 (6*3*2) = 36?
    Yes, and in post #5 you said:
    ... is it possible to ignore the first 2 worksheets?

+ 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. Select specific rows from separate worksheets and import into master worksheet
    By shaunguyver in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 09-07-2020, 08:13 AM
  2. Macro or VBA to select rows in other worksheets in date range.
    By kaxxp in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 02-17-2014, 12:23 AM
  3. Macro or VBA to select rows in other worksheets in date range.
    By kaxxp in forum Excel Formulas & Functions
    Replies: 0
    Last Post: 01-30-2014, 09:19 PM
  4. Freeze select columns/rows between a range of worksheets
    By thebutlerdidit in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 08-21-2013, 03:29 PM
  5. VBA Count Rows and Print Corresponding Worksheets
    By kboy1289 in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 10-17-2012, 05:27 PM
  6. How to select unique rows and count in excel
    By Nitu in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 11-24-2008, 06:00 PM
  7. Replies: 2
    Last Post: 07-15-2005, 11:05 AM

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