Forum Discussion
Diana703
Sep 13, 2022Copper Contributor
Excel Code to Send/Not Send Email Based on Date
I need to insert code into my existing macro that will send email based on two things: 1) If Cell P (Email Sent) has a date in it, don't send any email; 2) Send only email if Cell O (Review Date) is...
- Sep 13, 2022
I was misled by your description. Change the line
If Range("P" & r).Value = "" And Range("Q" & r).Value <> "" And Range("O" & r).Value >= Range("Q" & r).Value - 120 Thento
If Range("P" & r).Value = "" And Range("Q" & r).Value <> "" And Range("O" & r).Value <= Date Then
Diana703
Sep 13, 2022Copper Contributor
It's still giving me the email for the contract that doesn't expire until 9/13/23. It should ignore that one until its 120 days prior to that date.
HansVogelaar
Sep 13, 2022MVP
I was misled by your description. Change the line
If Range("P" & r).Value = "" And Range("Q" & r).Value <> "" And Range("O" & r).Value >= Range("Q" & r).Value - 120 Then
to
If Range("P" & r).Value = "" And Range("Q" & r).Value <> "" And Range("O" & r).Value <= Date Then- Diana703Sep 14, 2022Copper ContributorIt works! How can I ever repay you for all the help you've given me...I could not have ever done this without your help. You are a good man and I wish I could meet you one day. Take care my friend, stay safe, and God bless you.