-1

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

Bert328
  • 119
  • 8

1 Answers1

1

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"")"
BruceWayne
  • 22,923
  • 15
  • 65
  • 110