Insert formula with VBA

  • Hi guys,

    I am trying to run this code but keep getting syntax error..


    Code
    Sub UpdateFormula()
    Range("K2").Formula = "=IF(ISNUMBER(MATCH(I2,'C1'!$I$2:I$66,0)),"","Not Found")"
    End Sub

    any ideas?


    Thank you

    • Best Answer

    Use this instead (note the extra double-quotes that wrap the double-quotes presente inside the original formula code):

    Code
    Range("K2").Formula = "=IF(ISNUMBER(MATCH(I2,'C1'!$I$2:I$66,0)),"""",""Not Found"")"
  • ady171

    Selected a post as the best answer.

Participate now!

Don’t have an account yet? Register yourself now and be a part of our community!