I have a macro which inserts formulas into a worksheet for the purpose of correcting any errors that may have been created on the worksheet. The macro has worked fine entering long embedded If Statements. Now I update the macro and add some more formulas and although they follow the exact format as before I'm getting a Run Time Error 1004 "Application-defined of object-defined error".
example of old formula: Cells(13, 132).Formula = "=IF(LEFT(EA13,3)=""Off"",0,IF(AND(EC13="""",(LEFT(DZ13,6)=""Called"")),0,IF(AND(EC13="""",(LEFT(DZ13,2)=""NC"")),""NCNS"",IF(AND(EC13="""",(LEFT(DZ13,2)=""Qu"")),0,IF(EC13<=0.2*(AND(EA13<=1)*AND(EA13>0.2)),1-EA13+EC13,IF(EC13>EA13,EC13-EA13,0))))))"
example of new formula:Cells(13, 158).Formula = "IF(LEFT(E13,3)=""OFF"",0,IF(LEFT(D13,3)=""OFF"",0,IF(LEFT(D13,1)=""#"",0,IF(LEFT(F13,2)=""NC"",0,0.5,IF(LEFT(D13,6)=""CALLED"",0.5,IF(F13>0,F13,0))))))"
I don't think it's the formula format as they're the same. I have several of these new statements and I have tried blocking them out in sequential order and I get the same error with the first that runs. Any ideas? Thanks
Bookmarks