I'm trying to add a formula in cell AE2 to my worksheet with the help of VBA Excel. However when I paste the formula in VBA and hit enter on the line I get the following error:
Compile error: Expected: end of statement
This is the piece of code and formula I'm trying to use:
Range("AE2").Select
ActiveCell.FormulaR1C1 = "=IF(OR(D2="ECHARGEUR2",D2="ECHARGEUR3",D2="ECHARGEUR1",D2="ECHARGERO2",D2="ECARD001",D2="ECARD002",D2="ECARD003"),L2,1*MID(D2,MATCH(TRUE,ISNUMBER(1*MID(D2,ROW($1:$8),1)),0),COUNT(1*MID(D2,ROW($1:$8),1))))"
Can someone see what I'm missing here?