Subtotal Ranges Of Varying Size

  • Hi,


    I have a worksheet that imports data from a text file which vary's in size each time from 100 to 1000 rows. I want to subtotal only rows with data. The current macro I use has a set range up to 1000 rows which creates the grand total at the bottom of the page and requires deletion of the blank rows.


    Is there a way for VBA to check for non-blank rows instead of the pre-defined range and set the sub-total function to only calc those rows?


    Thanks for any help on this.


    KC

  • Re: Subtotal Ranges Of Varying Size


    In your macro, you can replace the fixed range references with a calculated range. For example, if the last entry in column A determines the end of the desired range, then instead of using

    Code
    Range("A1:F1000")


    use

    Code
    Range ("A1:F" & Cells(Rows.Count, 1).End(xlUp).Row)

Participate now!

Don’t have an account yet? Register yourself now and be a part of our community!