View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
Stefano Gatto Stefano Gatto is offline
external usenet poster
 
Posts: 59
Default GROUP BY & SUB TOTAL - HOW to do it???

Instantiate Access copy the data to a table there, build an SQL with GROUPBY
and return the data to Excel... programmatically. That was a joke! :-)

Seriously, you should create a new column concatenating col 3 & col 4, sort
by this new column, then record a macro while you use Tools/Subtotals on that
new column and see what it gives out in VBA. At this point you have the
subtotals, but the source data is still there, interlaced. To remove it, I
think you need to scroll through the list (For Each loop... ) and copy out
all that has a given outline level.

You may also code a Group-by function in VBA

--
Stefano Gatto


"Sally" wrote:

I have rows of data as below, I want to group by col 3 & col 4 then sub total
by col 5, how can I do this via macro VBA?

1 2 3 4 5
A 3000 PETER GBP -510.00
B 2500 SARAH USD -1000.00
C 1100 PETER GBP 502.00
D 560 CLAIRE USD 682.00
E 1885 PETER USD 6100.00
F 980 CLAIRE USD -1800.00
G 3220 SARAH EUR 699.00
H 6110 SARAH EUR -500.00

--
Thanks
Sally