Follow

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use
Contact

VBA Expected end of statement can't find the syntax error

I am trying to apply a formula to a column in and I get an "expected end of statement error"

  Sub Test()
    
    
    Range("T2:T").FormulaR1C1 = "=IF($D2= "EMMEGI SCA 550 SMALL SAW","OK","Not OK")"
    
    End Sub
   

when the error pops up EMMEGI is highlighted

MEDevel.com: Open-source for Healthcare and Education

Collecting and validating open-source software for healthcare, education, enterprise, development, medical imaging, medical records, and digital pathology.

Visit Medevel

>Solution :

You need to use Double Quotes when creating formulas with VBA:

Range("T2:T").FormulaR1C1 = "=IF($D2=""EMMEGI SCA 550 SMALL SAW"",""OK"",""Not OK"")"
Add a comment

Leave a Reply

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use

Discover more from Dev solutions

Subscribe now to keep reading and get access to the full archive.

Continue reading