Summing the bottoms of two columns

cguy3000

New Member
Joined
May 30, 2019
Messages
15
Hey guys!!

Alright so I have a rather simple problem that I just cant seem to figure out for the life of me. Its fairly straightforward.

So I have a data table,

[TABLE="width: 174"]
<tbody>[TR]
[TD="align: right"]5[/TD]
[TD="align: right"]241[/TD]
[/TR]
[TR]
[TD="align: right"]3[/TD]
[TD="align: right"]244[/TD]
[/TR]
[TR]
[TD="align: right"]4[/TD]
[TD="align: right"]248[/TD]
[/TR]
[TR]
[TD="align: right"]3[/TD]
[TD="align: right"]251[/TD]
[/TR]
[TR]
[TD="align: right"]225[/TD]
[TD][/TD]
[/TR]
</tbody>[/TABLE]
I want to take the 251 in its cell, add it to the 225s cell, and then put the new sum total value directly under the 251. And simply repeate that pattern of cell summing every time I hit the macro button. I assume you use some sort of Range("A5").End(xlDown) formula to select the bottoms of these columns but I cant figure out how to write it to do what I want.

Thanks guys!
 

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.
Hi cguy3000,

Try this:

Code:
Option Explicit
Sub Macro1()
    
    Dim lngLastRow As Long
    
    lngLastRow = Cells(Rows.Count, "B").End(xlUp).Row
    
    Range("B" & lngLastRow + 1).Formula = "=B" & lngLastRow & "+A" & lngLastRow + 1

End Sub

HTH

Robert
 
Upvote 0
How about

Code:
Sub macro2()
  Range("B" & Rows.Count).End(xlUp)(2) = Range("B" & Rows.Count).End(xlUp) + Range("A" & Rows.Count).End(xlUp)
End Sub
 
Upvote 0

Forum statistics

Threads
1,223,230
Messages
6,170,883
Members
452,364
Latest member
springate

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