View Single Post
  #1   Report Post  
Posted to microsoft.public.excel.programming
mthomas[_9_] mthomas[_9_] is offline
external usenet poster
 
Posts: 1
Default Group values and sum using loop


Yea, I just decided to record a macro for the Sub Totals feature and
tweak it a bit and it does the job. Because the number of rows vary,
I'm using the lastRow variable to make it dynamic.

Dim lastRow
lastRow = Cells(Rows.Count, 1).End(xlUp).Row

Range("I" & beginRow & "").Select
Selection.Subtotal GroupBy:=9, Function:=xlSum,
TotalList:=Array(8), _
Replace:=True, PageBreaks:=False, SummaryBelowData:=True

Thanks all!


--
mthomas
------------------------------------------------------------------------
mthomas's Profile: http://www.excelforum.com/member.php...o&userid=25649
View this thread: http://www.excelforum.com/showthread...hreadid=393365