Reputation: 65
I am struggling to assign the formula I have to the cell using VBA. The code is like below :
x.Sheets("Sheet2").Range("E2").Formula = "=IF(AND(B2>TIME(9;0;0);B2<TIME(18;0;0);ISNUMBER(SEARCH("CIXIS";C2)));"TRUE";"FALSE")"
But interestingly the macros does not accept any if formula. I think it is because of the quotation mark but I used Char(34)
, but no success. I even added double quotation mark, still not any success. I know that we should be able to assign formula using macros, what I am doing wrong? Any help would highly appreciated.
Upvotes: 0
Views: 414
Reputation: 166331
x.Sheets("Sheet2").Range("E2").Formula = _
"=IF(AND(B2>TIME(9,0,0),B2<TIME(18,0,0)," & _
"ISNUMBER(SEARCH(""CIXIS"",C2))),""TRUE"",""FALSE"")"
Upvotes: 2