I'm trying to insert a formula in my Excel 97 worksheet through a VBA script. I want to insert a formula wich contains the IF statement but I get an error message. How can I solve this ? My code is as follows :
Range("E2"
.Formula = "=IF(AND(D2<0;D1>=0);1;99)"
Range("F2"
.Formula = "=IF(E2=1;C2;F1)"
Range("G2"
.Formula = "=IF(AND(D2>=0;D1<0);C2-F2;99)"
Range("H2"
.Formula = "=D1"
I also tried to do this with a string variable but with the same error.
Bert.
Range("E2"
Range("F2"
Range("G2"
Range("H2"
I also tried to do this with a string variable but with the same error.
Bert.