hazelsisson
Programmer
Hi!
I'm having trouble trying to set formulae in a range of Excel cells using this code:
The MsgBox pops up correctly, so it seems to be the last line (Set Address.Formula = (myFormula)) that's causing problems. It's the Object required (Error 424) error that occurs.
Any ideas?
Thanks,
Hazel
I'm having trouble trying to set formulae in a range of Excel cells using this code:
Code:
Sub p1formula()
For i = 10 To 12
Dim Address, myFormula
Address = "EX" & i
jref = "Sheet1!J" & i
rref = "Sheet1!R" & i
myFormula = "=SUM(INDIRECT(" & jref & ")+INDIRECT(" & rref & "))"
Response = MsgBox(myFormula)
Set Address.Formula = (myFormula)
Next i
End Sub
The MsgBox pops up correctly, so it seems to be the last line (Set Address.Formula = (myFormula)) that's causing problems. It's the Object required (Error 424) error that occurs.
Any ideas?
Thanks,
Hazel