Error referencing lastRow

deduwa

Board Regular
Joined
Jul 28, 2015
Messages
110
Hi

I am trying to input a formula into column V as below. I get a Compile error: Expected end of statement message pop up.

Dim lastRow As Long
Set fnd = Range("A:A").Find("Currency", , , xlWhole, , , False, , False)
If fnd Is Nothing Then Exit Sub
lastRow = Cells(Rows.Count, "D").End(xlUp).Row

Range("V2:V" & fnd.Row - 1).FormulaR1C1 = "=IF(AND(RC[-18]=""POUND STERLING"",Manual!R1C6=1),(RC[-8]+RC[-7])/"R"&lastRow+53)*"Q"&lastRow+53"


It doesn't like the " around the R and around the Q.

What I am trying to achieve is in column V input a formula referencing a cell that is located 53 cells below lastRow of column R and 53 cells below lastRow of column Q

How can I achieve this?

Thanks
 
If you want it fixed at 319 always then you dont need lastRow at all. I cant know what you need as i cant see the sheet.
 
Upvote 0

Excel Facts

Select all contiguous cells
Pressing Ctrl+* (asterisk) will select the "current region" - all contiguous cells in all directions.

Forum statistics

Threads
1,223,236
Messages
6,170,915
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