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
You've got to be so tired of me! Bless your heart.
What I need is for it to not send an email if there is already a date in Email Sent in Column P (that is the date that is put in automatically when the email goes out) but to send the email for the cells that are empty (no date in them). At the same time, I need for it to only send emails to those where the Expiration Date in Column Q is a max of 120 days prior to that date. So you see, it has two conditions that need to be met prior to sending the email.
You are such a wonderful person. I'm embarrassed that I'm bothering you again but thank you for all you are doing.
What I need is for it to not send an email if there is already a date in Email Sent in Column P (that is the date that is put in automatically when the email goes out) but to send the email for the cells that are empty (no date in them). At the same time, I need for it to only send emails to those where the Expiration Date in Column Q is a max of 120 days prior to that date. So you see, it has two conditions that need to be met prior to sending the email.
You are such a wonderful person. I'm embarrassed that I'm bothering you again but thank you for all you are doing.
HansVogelaar
Sep 13, 2022MVP
You write "where the Expiration Date in Column Q is a max of 120 days prior to that date."
What is that date? The date in column O?
- Diana703Sep 13, 2022Copper ContributorBoth of these dates vary. The Review Date (Column O) is automatic with a simple formula (=Q5-120). The Expiration Date (Column Q) varies for each contract.