Loop & Sum Subtotal VBA

Anilk

New Member
Joined
Feb 15, 2007
Messages
24
Hi,

I have a set of numbers which run like this ...

Amount 1 Amount 2
$5000
$200
$4300
$1800
$600
$2000
$500
$1200
$2000

My Amount count will go to thousands..., How can i write a macro so as it will shown the sum of Amount 2 with corresponding figures in Amount1, and a row inserted after every sub total (matched).......... say..... something like this...

Amount 1 Amount 2
$5000
$200
$4300
$500

Subtotal $5000 $5000

$1800
$600
$1200

Subtotal $ 1800 $1800

$2000
$2000

Subtotal $2000 $2000

Thanks in anticipation for any kind help by you guys please.......

Cheers

AK
 

Excel Facts

Using Function Arguments with nested formulas
If writing INDEX in Func. Arguments, type MATCH(. Use the mouse to click inside MATCH in the formula bar. Dialog switches to MATCH.
oops sorry, the figures shud look like this
Amount 1 Amount 2
$5000
$200
$4300
$1800
$600
$2000
$500
$1200
$2000

and the resultant is somethis like this
Amount 1 Amount 2
$5000 $200
$4300
$500
Subtotal $5000 $5000

$1800 $600
$1200
Subtotal $1800 $1800

$2000 $2000
Subtotal $2000 $2000
 
Upvote 0
actually i am unable to copy my sheet over there...... pls ignore my ignorance

Basically, in this fomrat, there r only 3 amounts in column1

$5000, $1800 & $2000

While the rest ($200, $4300, $500, $1200, $600, $2000)are in Column 2, now i want to make a VBA macro so that all the amounts in col 2 which total to the amount in col 1 can be segregated.

say something like this.
the sum of $200,$4300 & $500 in col 2, corresponds to $5000 of col 1
 
Last edited:
Upvote 0

Forum statistics

Threads
1,224,596
Messages
6,179,807
Members
452,944
Latest member
2558216095

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top