Help with Macro if cell is either blank or past a certain date

JusticeLeague2018

New Member
Joined
Mar 6, 2018
Messages
4
Hello all!
I'm new here. So I have a tracking worksheet.

I have a date that a client called in column B (Their name is in column A)

The calls get assigned and the person to call back, and they will let me know when they reach out.

They have two business days to do so.

The date returned is in column K and the two business days (after column B) are in column L.

I need a macro that will send an email to "someone@someplace.com" when the column K (or date returned) is blank and also when the days to respond by is after the two business days in Column B (which I have in column L). I would want the row where K is blank or past the two business days to be sent in the body of this email.

Can anyone help me?

Thanks
 

Excel Facts

How to find 2nd largest value in a column?
MAX finds the largest value. =LARGE(A:A,2) will find the second largest. =SMALL(A:A,3) will find the third smallest
I'm not sure what help you are asking for.... Break the problem in to parts. Solve them one by one.

Here is information about sending e-mails from VBA:
https://www.rondebruin.nl/win/s1/outlook/mail.htm

So my code is below but I want it to only email if the cell (i, 11) (or a cell in Column K) is blank.
______________

Sub eMail()
Dim lRow As Integer
Dim i As Integer
Dim toDate As Date
Dim toList As String
Dim eSubject As String
Dim eBody As String
With Application
.ScreenUpdating = False
.EnableEvents = False
.DisplayAlerts = False
End With
Sheets(1).Select
lRow = Cells(Rows.Count, 4).End(xlUp).Row
For i = 2 To lRow
toDate = Replace(Cells(i, 2), ".", "/")
If Left(Cells(i, 11), 4) <> "Mail" And toDate - Date <= 0 Then
Set OutApp = CreateObject("Outlook.Application")
Set OutMail = OutApp.CreateItem(0)
toList = Cells(i, 3) 'gets the recipient from col M
eSubject = "Call to " & Cells(i, 2) & " is due on " & Cells(i, 12)
eBody = "Person: " & Cells(i, 4) & vbCrLf & vbCrLf & "Please note that the following callers call has not been returned: " & Cells(i, 1)

On Error Resume Next
With OutMail
.To = "Someone@something.com"
.CC = ""
.BCC = ""
.Subject = "Call Return Due"
.Body = eBody
.bodyformat = 1
.Display ' ********* Creates draft emails. Comment this out when you are ready
'.Send '********** UN-comment this when you are ready to go live
End With

On Error GoTo 0
Set OutMail = Nothing
Set OutApp = Nothing
Cells(i, 23) = "Mail Sent " & Date + Time 'Marks the row as "email sent in Column W"
End If
Next i
ActiveWorkbook.Save
With Application
.ScreenUpdating = True
.EnableEvents = True
.DisplayAlerts = True
End With
End Sub
 
Upvote 0
Like this?

Code:
If Cells(i, 11) = vbNullString And toDate - Date <= 0 Then


HackSlash, THANK YOU, Works great, I really appreciate it!!!

I have one more question.

I am trying to send that email to an email that is in column O (i, 14)

right now i have it going to one specific email which would be the supervisor but it would make more sense and less work for everyone if they could go the the person that is assigned to the call.

I have this now:
On Error Resume Next
With OutMail
.To = "Someone@Something.com"
.CC = ""
.BCC = ""
.Subject = "Call to " & Cells(i, 1) & " is due on " & Cells(i, 12)
.Body = eBody
.bodyformat = 1
.Display ' ********* Creates draft emails. Comment this out when you are ready
'.Send '********** UN-comment this when you are ready to go live

Any thoughts?
 
Upvote 0
Well, you're talking about the ".To =" part. And you want the value of a cell. You even told me the cell reference. So:

Code:
.To = Cells(i, 14).Value

Does this make sense? I feel like you could have done that yourself.
 
Upvote 0
Well, you're talking about the ".To =" part. And you want the value of a cell. You even told me the cell reference. So:

Code:
.To = Cells(i, 14).Value

Does this make sense? I feel like you could have done that yourself.

I probably could have but I am so sick that my head is not working right.

It totally worked! Thank you again!
 
Upvote 0

Forum statistics

Threads
1,221,310
Messages
6,159,176
Members
451,543
Latest member
cesymcox

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top