trivera648
New Member
- Joined
- Jan 29, 2021
- Messages
- 4
- Office Version
- 365
- Platform
- Windows
Hello everyone,
I would like to sum up the value from two cells located in the same row, onto a third cell also located in the same row. I'm having trouble coming up with the easiest way to do this.
The amount of rows in the worksheet always changes.
As you can see below, in my "For Each Cell In ARng" I've tried doing offset, =Sum, I can't seem to get it right.
The two values to be added together are always going to be on the same row, columns J and L. And the sum should always come out in Column N.
Any help would be most appreciated.
I would like to sum up the value from two cells located in the same row, onto a third cell also located in the same row. I'm having trouble coming up with the easiest way to do this.
The amount of rows in the worksheet always changes.
As you can see below, in my "For Each Cell In ARng" I've tried doing offset, =Sum, I can't seem to get it right.
The two values to be added together are always going to be on the same row, columns J and L. And the sum should always come out in Column N.
Any help would be most appreciated.
VBA Code:
VBA Code:
Code:
Sub Test3()
'TOTAL AMOUNT COLUMN SUMMED AUTO
Dim ARng As Range
Dim ALastCell As Range
Dim ACell As Range
'DEFINING LAST CELL IN COLUMN N (TOTAL REFUND AMOUNT)
Set ALastCell = Cells(Rows.Count, "N").End(xlUp)
'DEFINING "RNG" AS RANGE FROM N2 TO LAST CELL
Set ARng = Range("N2", ALastCell)
For Each Cell In ARng
'Cell.Value = Cells( + ActiveCell.Offset(-2)
' 'Cell.Value = "=SUM(OFFSET(-4,) + (-2,)"
'.FormulaR1C1 = "=SUM(RC[-4,]:RC[-2,])"
'ActiveCell.Formula = "=Sum(" & ActiveCell.Offset(-4) & "+" & ActiveCell.Offset(-2)
Next Cell
End Sub