Adjusting formulas to fit within side VBA

Viewed 29

I'm running into a bit of issues getting my formula to work within VBA.

VBA:

Range("K2").Formula = "=IF(SUM(COUNTIF(J2,{"*Advanced Diploma*","*Diploma*"})),H2/10,H2/10*2)"

Excel:

=IF(SUM(COUNTIF(J2,{"*Advanced Diploma*","*Diploma*"})),H2/10,H2/10*2)

The error I am getting is that there is a syntax error. Please disregard discrepancy between cells referenced.

Your help would be very much appreciated.

Thanks!

1 Answers

You need to double up like this "" in order to escape ":

Range("K2").Formula = "=IF(SUM(COUNTIF(J2,{""*Advanced Diploma*"",""*Diploma*""})),H2/10,H2/10*2)"
Related