Finding relative positions method - one works, the other doesn't???

ReneZ

New Member
Joined
May 19, 2015
Messages
20
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
 
Last edited:

Excel Facts

Excel Can Read to You
Customize Quick Access Toolbar. From All Commands, add Speak Cells or Speak Cells on Enter to QAT. Select cells. Press Speak Cells.
Try

Range("F" & (lastrow + 1) & ":F" & (lastrow + 3)).Formula = "=IF(E34=""Yes"",0,D34*$D$10)"

Hope this helps

M.
 
Upvote 0

Forum statistics

Threads
1,223,237
Messages
6,170,928
Members
452,366
Latest member
TePunaBloke

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top