Place "" In VBA Generated Formula

  • I am attempting to use VBA to place the following formula in a cell:


    =sumif(A:A,(cell two columns to the left and one row up),C:C)


    The code I'm using is:


    ActiveCell.Formula = _
    "=SUMIF(A:A," & Range("A" & x - 1) & ",C:C)"


    This problem is that the search criteria is a date and needs "" around it. The formula I am generating at this point is:


    =SUMIF(A:A,10/1/2004,C:C)


    It needs to be:


    =SUMIF(A:A,"10/1/2004",C:C)


    If I try to use """ in VBA, I get an error. How do you place quotation marks in a formula???


    Thanks.


    Chris

Participate now!

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