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,

5241
3244
4248
3251
225

<tbody>
</tbody>
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

Test for Multiple Conditions in IF?
Use AND(test, test, test, test) or OR(test, test, test, ...) as the logical_test argument of IF.
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,214,120
Messages
6,117,845
Members
448,782
Latest member
lepaulek

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