SailorJerry7030
New Member
- Joined
- Apr 27, 2018
- Messages
- 30
Here's the current code:
'SH DATA COL P = DUE DATE
Worksheets("SH Data").Range("P2").Formula = "=IF(AND(OR(J2=""NEWCLAIM2"",J2=""WEBRECVD"",J2=""KECREATED""),ISBLANK(M2)=TRUE)=TRUE,WORKDAY(D2,O2),IF(Q2=""REWORK"",WORKDAY(D2,O2)," _
& "IF(OR(Q2=""QUESTION"",Q2=""RQMT RECVD"",Q2=""ACTIONABLE PENDING""),WORKDAY(C2,O2)," _
& "IF(AND(OR(Q2=""NEW CLAIM"",Q2=""ACTIONABLE PENDING""),OR(J2=""AALSAPPROV"",J2=""DISBDONE"",J2=""OK"",J2=""PROCESSED"",J2=""CDSTIMEOUT"",J2=""AWDNOAPPRV"",J2=""NOAALSAPRV"")),WORKDAY(C2,O2)," _
& "IF(AND(ISBLANK(M2)=TRUE)=TRUE,WORKDAY(C2,O2),WORKDAY(M2,O2))))))"
'New code
Worksheets("SH Data").Range("P2").Formula = "=IF(AND(G2=""DIPAYMENTS"",J2=""PEND30""),D2+O2,"")"
Essentially it runs through the first formula, then goes back through and if the AND statement is met for G2 & J2 it adds Column D2 (Date) and O2 (in this situation "30") for 30 days. If it's not met, I want it to keep the results of the first long formula. Unfortunately, when I run it as-is, I get "Run-Time error '1004': Application-defined or object defined error. If I remove the false statement it works fine once the AND criteria is met, but everything from the first formula is overwritten with "FALSE". Any help please?
'SH DATA COL P = DUE DATE
Worksheets("SH Data").Range("P2").Formula = "=IF(AND(OR(J2=""NEWCLAIM2"",J2=""WEBRECVD"",J2=""KECREATED""),ISBLANK(M2)=TRUE)=TRUE,WORKDAY(D2,O2),IF(Q2=""REWORK"",WORKDAY(D2,O2)," _
& "IF(OR(Q2=""QUESTION"",Q2=""RQMT RECVD"",Q2=""ACTIONABLE PENDING""),WORKDAY(C2,O2)," _
& "IF(AND(OR(Q2=""NEW CLAIM"",Q2=""ACTIONABLE PENDING""),OR(J2=""AALSAPPROV"",J2=""DISBDONE"",J2=""OK"",J2=""PROCESSED"",J2=""CDSTIMEOUT"",J2=""AWDNOAPPRV"",J2=""NOAALSAPRV"")),WORKDAY(C2,O2)," _
& "IF(AND(ISBLANK(M2)=TRUE)=TRUE,WORKDAY(C2,O2),WORKDAY(M2,O2))))))"
'New code
Worksheets("SH Data").Range("P2").Formula = "=IF(AND(G2=""DIPAYMENTS"",J2=""PEND30""),D2+O2,"")"
Essentially it runs through the first formula, then goes back through and if the AND statement is met for G2 & J2 it adds Column D2 (Date) and O2 (in this situation "30") for 30 days. If it's not met, I want it to keep the results of the first long formula. Unfortunately, when I run it as-is, I get "Run-Time error '1004': Application-defined or object defined error. If I remove the false statement it works fine once the AND criteria is met, but everything from the first formula is overwritten with "FALSE". Any help please?