I’m doing some “code culling” with my current project.
In some cases where I required code for a temporary calculation, I would use a formula, record macro of that formula, then use the macro to do the same calculation, then use another line of code to keep the Sum, but remove the formula because it’s no longer required within that particular Loop.
For example,
Sub sumthis ()
‘ lines of code
Sheets(“test1”).Range(“D1”).FormulaR1C1 = “=SUM(R4C9:R28C9)” ‘ adds formula
Sheets(“test1”).Range(“D1”).Value = Sheets(“test1”).Range(“D1”).Value ‘ leaves Sum but no formula
‘more lines of code
End sub
actual formula: =SUM($I$4:$I$28)
Is there a way of writing the code: FormulaR1C1 = “=SUM(R4C9:R28C9)”
so it sums that range/column and have the result only in cell D1 so I can remove 1 line of code?
Thanks