View Single Post
  #3   Report Post  
Posted to microsoft.public.excel.programming
No Name
 
Posts: n/a
Default Sort, Subtotal, Label Subtotal, Insert row

Unfortunately, it's not that easy to work with
subtotals. But I can give you a few hints to get started.

You can use the Excel subtotal funtion to get started.

.Range("A2").Subtotal GroupBy:=iColCount, _
Function:=xlCount, TotalList:=Array(3), _
Replace:=True, PageBreaks:=False, SummaryBelowData:=True

Then you need to loop through all the rows to find
subtotals

iRowCount = ws.Range("A1").CurrentRegion.Rows.Count
For i = 2 To iRowCount
If Rows(i).OutlineLevel <= 2 Then
ADD WHAT YOU NEED TO DO HERE
Next i

Diane


-----Original Message-----
I have 4 columns. Need to do following:-

- sort by columns A, B, C in ascending order.
- subtotal on change of column C
- change subtotal text to "Subtotal for Sto XXX"

where XXX is column C
- insert a line after each subtotal for easy reading
- insert grand total at end.

I think this may sound easy for most of you. But I'm

novice. Plse help.
Thanks.


.