Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
**HELP** VBA code to insert subtotals
Hi,
I've got a question. I would like to use vba code to loop trough a worksheet and insert subtotals Let say this is de worksheet: A B C D E 500100 2100 $ 10,000.00 $ 6,000.00 $ 17,000.00 500100 2110 $ 15,000.00 $ 4,000.00 $ 20,000.00 500100 2120 $ 10,000.00 $ 6,000.00 $ 17,000.00 500200 2100 $ 12,000.00 $ 6,000.00 $ 15,000.00 500200 2100 $ 10,000.00 $ 6,000.00 $ 17,000.00 500200 2100 $ 18,000.00 $ 9,000.00 $ 16,000.00 500300 2100 $ 10,000.00 $ 6,000.00 $ 27,000.00 500300 2100 $ 10,000.00 $ 7,000.00 $ 17,000.00 500300 2100 $ 19,000.00 $ 6,000.00 $ 37,000.00 The desired result should be something like this. A B C D E 500100 2100 $ 10,000.00 $ 6,000.00 $ 17,000.00 500100 2110 $ 15,000.00 $ 4,000.00 $ 20,000.00 500100 2120 $ 10,000.00 $ 6,000.00 $ 17,000.00 subtotal $ 35,000,00 $ 16,000.00 $ 54,000.00 500200 2100 $ 12,000.00 $ 6,000.00 $ 15,000.00 500200 2100 $ 10,000.00 $ 6,000.00 $ 17,000.00 500200 2100 $ 18,000.00 $ 9,000.00 $ 16,000.00 subtotal $ 40,000,00 $ 21,000.00 $ 38,000.00 500300 2100 $ 10,000.00 $ 6,000.00 $ 27,000.00 500300 2100 $ 10,000.00 $ 7,000.00 $ 17,000.00 500300 2100 $ 19,000.00 $ 6,000.00 $ 37,000.00 subtotal $ 39,000,00 $ 19,000.00 $ 81,000.00 grandtotal $ 114,000.00 $ 56,000.00 $ 173,000.00 Does anyone has an example on how to get a result as shown above? Help appreciated, Farmer |
#2
Posted to microsoft.public.excel.programming
|
|||
|
|||
**HELP** VBA code to insert subtotals
Hi
and why not use 'Data - Subtotal' -- Regards Frank Kabel Frankfurt, Germany farmer wrote: Hi, I've got a question. I would like to use vba code to loop trough a worksheet and insert subtotals Let say this is de worksheet: A B C D E 500100 2100 $ 10,000.00 $ 6,000.00 $ 17,000.00 500100 2110 $ 15,000.00 $ 4,000.00 $ 20,000.00 500100 2120 $ 10,000.00 $ 6,000.00 $ 17,000.00 500200 2100 $ 12,000.00 $ 6,000.00 $ 15,000.00 500200 2100 $ 10,000.00 $ 6,000.00 $ 17,000.00 500200 2100 $ 18,000.00 $ 9,000.00 $ 16,000.00 500300 2100 $ 10,000.00 $ 6,000.00 $ 27,000.00 500300 2100 $ 10,000.00 $ 7,000.00 $ 17,000.00 500300 2100 $ 19,000.00 $ 6,000.00 $ 37,000.00 The desired result should be something like this. A B C D E 500100 2100 $ 10,000.00 $ 6,000.00 $ 17,000.00 500100 2110 $ 15,000.00 $ 4,000.00 $ 20,000.00 500100 2120 $ 10,000.00 $ 6,000.00 $ 17,000.00 subtotal $ 35,000,00 $ 16,000.00 $ 54,000.00 500200 2100 $ 12,000.00 $ 6,000.00 $ 15,000.00 500200 2100 $ 10,000.00 $ 6,000.00 $ 17,000.00 500200 2100 $ 18,000.00 $ 9,000.00 $ 16,000.00 subtotal $ 40,000,00 $ 21,000.00 $ 38,000.00 500300 2100 $ 10,000.00 $ 6,000.00 $ 27,000.00 500300 2100 $ 10,000.00 $ 7,000.00 $ 17,000.00 500300 2100 $ 19,000.00 $ 6,000.00 $ 37,000.00 subtotal $ 39,000,00 $ 19,000.00 $ 81,000.00 grandtotal $ 114,000.00 $ 56,000.00 $ 173,000.00 Does anyone has an example on how to get a result as shown above? Help appreciated, Farmer |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
Insert Code | Excel Worksheet Functions | |||
How to insert code | Excel Discussion (Misc queries) | |||
Insert-Subtotals makes Column Outlines disappear | Excel Worksheet Functions | |||
Insert Code | New Users to Excel | |||
How do I insert subtotals? | New Users to Excel |