Hello,
I´m new to VBA and I wonder if you can put a variable inside the brackets when using .FormulaR1C1.
Here is an example of what I´m trying to do:
Do you have a solution ?
I´m new to VBA and I wonder if you can put a variable inside the brackets when using .FormulaR1C1.
Here is an example of what I´m trying to do:
Code:
Sub b()
Dim fl As Integer
Dim fc As Integer
Dim nb_parts As Integer
Dim nb_measurments As Integer
fl = 8
fc = 8
nb_measurments = 7
nb_parts = 30
For x = 0 To nb_measurments - 1
Cells(fl + nb_parts + 4, fc + x).FormulaR1C1 = "=AVERAGE(R[-(nb_parts)]C:R[-4]C)" 'here i get run time error 1004
Next x
End Sub
Do you have a solution ?