yasarayhanka
08-14-2007, 09:33 AM
I am trying to select a relative range and take the subtotals of it, my relative ranges do not have the top row as headlines so I need to start selecting from one row above the relative range ( at subtotal it accepts the top line of the range as headlines) and I want to loop this untill there are no relative ranges below my data.
here is the code I tried but it only selects two rows of my range.
StartCell = ActiveCell.Offset(0, 0).Address
EndCell = ActiveCell.Offset(0, 2).Address
Range(StartCell, EndCell).Select
Range(Selection, Selection.End(xlDown)).Select
Range(Selection, Selection.End(xlDown)).Select
Selection.Subtotal GroupBy:=2, Function:=xlSum, TotalList:=Array(3), _
Replace:=True, PageBreaks:=False, SummaryBelowData:=True
I will appreciate any help you guys can provide.
Thanks in advance
Yasar
here is the code I tried but it only selects two rows of my range.
StartCell = ActiveCell.Offset(0, 0).Address
EndCell = ActiveCell.Offset(0, 2).Address
Range(StartCell, EndCell).Select
Range(Selection, Selection.End(xlDown)).Select
Range(Selection, Selection.End(xlDown)).Select
Selection.Subtotal GroupBy:=2, Function:=xlSum, TotalList:=Array(3), _
Replace:=True, PageBreaks:=False, SummaryBelowData:=True
I will appreciate any help you guys can provide.
Thanks in advance
Yasar