Add cell in one column result in different column

sarah1024

New Member
Joined
Oct 15, 2018
Messages
7
Hello,
I need help with VBA code inserting sum of cells in column R in to column T which are separated by two empty rows.
values in column R starts at row 2.

Here is an example:

Column RColumn T
258.05567.42
309.37
426.19930.44
504.25
608.14608.29
0.15

<colgroup><col><col></colgroup><tbody>
</tbody>

I greatly appreciate the help!

Thank you!
 

Excel Facts

Waterfall charts in Excel?
Office 365 customers have access to Waterfall charts since late 2016. They were added to Excel 2019.
Hello,

Is there a real necessity to have VBA ... when a formula can perform the calculation ...? :wink:
 
Upvote 0
Welcome to the MrExcel board!

Assuming column R numbers are not the result of formulas, try this in a copy of your workbook.
Code:
Sub Insert_Sum()
  Dim rA As Range
  
  For Each rA In Columns("R").SpecialCells(xlConstants, xlNumbers).Areas
    rA.Cells(1, 3).Value = Application.Sum(rA)
  Next rA
End Sub
 
Upvote 0
Hello,

In cell T2, you can test the Array formula :

Code:
=SUM(OFFSET(R2,0,0,MATCH(TRUE,ISBLANK(R3:$R$100),0),1))

Hope this will help
 
Upvote 0

Forum statistics

Threads
1,215,130
Messages
6,123,220
Members
449,091
Latest member
jeremy_bp001

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