I know the ways of using ".PasteSpecial xlPasteFormulas" or "range.AutoFill", but I try to find a way to use the array variable.
I want to copy the formulas in range C4:D4 to the range C7:D11 which has multiple range.
C4 = A4+B4
D4 = Average(A4:C4)
So I made a vba script like this.
Sub test()
Dim v
v = Range("C4:D4").FormulaR1C1
Range("C7:D11").FormulaR1C1 = v
End Sub
After running the vba, the formulas in c7 and d7 were like this, as I expected.
c7 = a7 + b7
d7 = average(A7:C7)
but the other cells' formulas were strange
c8 = a9 + b9
d8 = average(A9:C9)
c9 = a11 + b11
d9 = average(A11:C11)
and so on.....
My questions are: 1. Why is this happening? 2. Any suggestion about the way of copying some formulas to multiple range by the way of using the array variable?
Thank you in advance.