Syntax error

Picola

New Member
Joined
Feb 4, 2014
Messages
8
Hello,

Can someone let me know why the following line triggers a "Syntax Error" ?

With ThisWorkbook.Worksheets(CST_ALLOCATION_SHEET_NAME)

.Range("O6").Formula = "=IF(OR($H6="PO100",$H6="PO120"),IFERROR(J6+$J6*INDEX(TecBase,MATCH(Raw_data_BW!$A8,TecBase!$B$6:$B$150,0),MATCH(O$4,TecBase!$L$5:$O$5,0)),""),J6)"

End with

Thanks a lot !
Picola
 

Excel Facts

Waterfall charts in Excel?
Office 365 customers have access to Waterfall charts since late 2016. They were added to Excel 2019.
You need to double-up the quotes within the formula

Code:
With ThisWorkbook.Worksheets(CST_ALLOCATION_SHEET_NAME)

    .Range("O6").Formula = "=IF(OR($H6=""PO100"",$H6=""PO120""),IFERROR(J6+$J6*INDEX(TecBase,MATCH(Raw_data_BW!$A8,TecBase!$B$6:$B$150,0),MATCH(O$4,TecBase!$L$5:$O$5,0)),""""),J6)"

End With
 
Upvote 0
Hello VOG,

Thanks it works ! But may I ask you why ? What is the logic behind ? Not sure to understand.

Thanks a lot again.



You need to double-up the quotes within the formula

Code:
With ThisWorkbook.Worksheets(CST_ALLOCATION_SHEET_NAME)

    .Range("O6").Formula = "=IF(OR($H6=""PO100"",$H6=""PO120""),IFERROR(J6+$J6*INDEX(TecBase,MATCH(Raw_data_BW!$A8,TecBase!$B$6:$B$150,0),MATCH(O$4,TecBase!$L$5:$O$5,0)),""""),J6)"

End With
 
Upvote 0
Without the """ the Excel compiler does not know where your formula code ends, denoted by ""
 
Upvote 0

Forum statistics

Threads
1,214,653
Messages
6,120,751
Members
448,989
Latest member
mariah3

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