Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11
Default **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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3,885
Default **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
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Insert Code Steph Excel Worksheet Functions 0 February 27th 10 06:08 PM
How to insert code Karl Excel Discussion (Misc queries) 3 January 8th 07 11:01 PM
Insert-Subtotals makes Column Outlines disappear gpie Excel Worksheet Functions 1 November 22nd 05 04:06 PM
Insert Code Derek Y via OfficeKB.com New Users to Excel 3 October 17th 05 03:48 AM
How do I insert subtotals? tlcnc New Users to Excel 1 October 13th 05 01:25 AM


All times are GMT +1. The time now is 09:10 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"