Application-defined or object-defined error

M

Meihua Liang

As the following example indicates, the R1C1 reference
style is used in .FormulaR1C1. The A1 reference style is
used with .Formula


'put numbers 2,4,6 in cell A1, A2 and A3
'get the sum in cell A4 and A5 with 2 difference
'reference styles
Sub test()
Range("A4").FormulaR1C1 = "=SUM(R1C1:R3C1)"

'error :
'Range("A4").FormulaR1C1 = "=SUM($A$1:$A$3)"

Range("A5").Formula = "=SUM($A$1:$A$3)"

End Sub


Examples from Microsoft online help:
Worksheets("Sheet1").Range("A1").Formula = "=$A$4+$A$10"

Worksheets("Sheet1").Range("B1").FormulaR1C1 = "=SQRT
(R1C1)"
 
Top