Hi, I'm trying to fill some cells in a spreadsheet with formulas, as the input can be changed after the routine has run.
The following works:
Range("F34:F" & lastrow).Formula = "=IF(E34=""Yes"",0,D34*$D$9)"
but the below, set up along the same lines, generates an error;
Range(("F" & (lastrow+1))"F" & (lastrow+3))).Formula = "=IF(E34=""Yes"",0,D34*$D$10)"
I tried isolating some with more parenthesis, but that didn't work either.
In the above form it gives a 'syntax error'. The same line below gives a 'compile error: syntax error'
Range("F" & (lastrow+1):"F" & (lastrow+3)).Formula = "=IF(E34=""Yes"",0,D34*$D$10)"
Could you please advise what I'm doing wrong? I would expect that, as the first is accepted, the second would run as well. Appreciate your help!
Regards, Rene
I'm using Excel 2010
The following works:
Range("F34:F" & lastrow).Formula = "=IF(E34=""Yes"",0,D34*$D$9)"
but the below, set up along the same lines, generates an error;
Range(("F" & (lastrow+1))"F" & (lastrow+3))).Formula = "=IF(E34=""Yes"",0,D34*$D$10)"
I tried isolating some with more parenthesis, but that didn't work either.
In the above form it gives a 'syntax error'. The same line below gives a 'compile error: syntax error'
Range("F" & (lastrow+1):"F" & (lastrow+3)).Formula = "=IF(E34=""Yes"",0,D34*$D$10)"
Could you please advise what I'm doing wrong? I would expect that, as the first is accepted, the second would run as well. Appreciate your help!
Regards, Rene
I'm using Excel 2010
Last edited: