Add data from cell D3 to last used cell then offset 1 down and place value

kelly mort

Well-known Member
Joined
Apr 10, 2017
Messages
2,169
Office Version
  1. 2016
Platform
  1. Windows
I want to add all data from D3 down to last used cell then go down 1 and place that result there. Can someone fix that for me?
 

Excel Facts

Best way to learn Power Query?
Read M is for (Data) Monkey book by Ken Puls and Miguel Escobar. It is the complete guide to Power Query.
Code:
Sub CutAndPaste()
  Dim Top As Range
  Dim Bottom As Range
  Set Top = Range("D3")
  Set Bottom = Top.End(xlDown)
  Range(Top, Bottom).Cut Destination:=Bottom.Offset(1)
End Sub
 
Upvote 0
Okay thanks. I have not tried it yet. I am not with my pc now. Can you explain the script for me?

I am confused with how the cut and paste will do the addition.

Regards
Kelly
 
Upvote 0
Is this what you want
Code:
Sub MySum()
Range("D" & Rows.Count).End(xlUp).Offset(1).FormulaR1C1 = "=sum(r1c:r[-1]c)"
End Sub
 
Upvote 0
Is this what you want
Code:
Sub MySum()
Range("D" & Rows.Count).End(xlUp).Offset(1).FormulaR1C1 = "=sum(r1c:r[-1]c)"
End Sub


Sure. But I don't really understand the formula. Can you digest it for me?
 
Upvote 0
It should actually be
Code:
=sum(r3c:r[-1]c)
The r3c is saying row 3 for that column(ie D3) whilst the r[-1]c is 1 row above the formula for that column.
So if the formula is in D40 its SUM(D3:D39)
 
Upvote 0

Forum statistics

Threads
1,223,893
Messages
6,175,246
Members
452,623
Latest member
cliftonhandyman

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