You can do this...
Sub fill_formulas()
Range("A3").Formula = "=A1+A2"
End Sub
or
Enter =A1+A2 into cell A3. Turn on the macro recorder and with you cursor on A3, select F2 then Enter
Turn off the macro recorder and look in the VBE. The macro has been recorded but it will be in the R1C1 style
After you record the macro, you can convert
FormulaR1C1 = "=R[-2]C+R[-1]C"
into the non R1C1 style if you would prefer.
In the VBE, Ctrl + G will open up the Immediate Window and then enter
debug.print Application.ConvertFormula("=R[-2]C+R[-1]C", xlR1C1, xlA1)
and at the end of the line press enter
You should now see
debug.print Application.ConvertFormula("=R[-2]C+R[-1]C", xlR1C1, xlA1)
=A2+A3
Bookmarks