0

i'm getting the "Expected End of line error" on the following formula which works fine as an excel formula:

Range("R2").Formula = "=IF(I2="C",CONCATENATE(J2,"",K2,,"",L2,"",M2," PAID WITH INVOICE ",B2,"FOR",E2,F2," ON ",TEXT(Q2,mm/dd/yyyy")),"")"

I tried breaking out the "R2" cell reference into 2 lines (ActiveSheet.Range("R2").Select) and (Selection.Formula) to see if that would help and it did not make a difference.

What doesn't VBA like about this formula?

Thanks in advance.

Ike
  • 9,580
  • 4
  • 13
  • 29

1 Answers1

0

You have to use double quotes within the string - and there is a quote missing in front of "mm/dd/..."

this should work: Range("R2").Formula = "=IF(I2=""C"",CONCATENATE(J2,"""",K2,,"""",L2,"""",M2,"" PAID WITH INVOICE "",B2,""FOR"",E2,F2,"" ON "",TEXT(Q2,""mm/dd/yyyy"")),"""")"

Ike
  • 9,580
  • 4
  • 13
  • 29