Hello,
So I've been using the following formula:
Sub MacroAddOne()
'
' MacroAddOne Macro
'
Dim r As Range: With Range("G15"): Set r = Cells(.Row, Columns.Count)(1): r.Formula = .Formula: r.Copy r(2): .Cells(1).Formula = r(2).Formula: r.Resize(2).Clear: End With
End Sub
This formula adds changes the formula in G15 from '=(B11-B10)/B10' to ='(B12-B11)/B11'.
Now I want to add the cells G16, G17 and G18 to this formula aswell, but I cant get it to work.
The things I tried are:
Dim r As Range: With Range("G15:G18"): Set r = Cells(.Row, Columns.Count)(1): r.Formula = .Formula: r.Copy r(2): .Cells(1).Formula = r(2).Formula: r.Resize(2).Clear: End With
and:
Dim r As Range: With Range("G15","G16","G17","G18"): Set r = Cells(.Row, Columns.Count)(1): r.Formula = .Formula: r.Copy r(2): .Cells(1).Formula = r(2).Formula: r.Resize(2).Clear: End With
These both didn't work.
Please let me know what im doing wrong.
Thanks in advance!
Bookmarks