I have a code built that, upon clicking a command button, displays an email to a coworker when a cell in column P is "X". When a cell in column P is updated a date stamp is automatically entered into the adjacent cell in column Q. How do I update my code so the email displays only if the adjacent cell in Q is stamped with today's date? I'm trying to only send email notifications for the newly added Xs. I hope that makes sense. Here's a copy of my current code and a screenshot of my worksheet. TIA!!
Sub Button11_Click()
Dim OutMail As Object
Dim cell As Range
Application.ScreenUpdating = False
For Each cell In Range("P:P")
If cell.Value = "X" Then
On Error Resume Next
Set OutMail = CreateObject("Outlook.Application").CreateItem(0)
With OutMail
.To = "Harrison.holden@osteocentric.com"
.Subject = "New Tooling Requested"
.Body = "Hi there, " & vbNewLine & vbNewLine & _
"You have been assigned a new action item."
.Display
End With
On Error GoTo 0
End If
Next cell
Set OutMail = Nothing
Application.ScreenUpdating = True
End Sub
Sub Button11_Click()
Dim OutMail As Object
Dim cell As Range
Application.ScreenUpdating = False
For Each cell In Range("P:P")
If cell.Value = "X" Then
On Error Resume Next
Set OutMail = CreateObject("Outlook.Application").CreateItem(0)
With OutMail
.To = "Harrison.holden@osteocentric.com"
.Subject = "New Tooling Requested"
.Body = "Hi there, " & vbNewLine & vbNewLine & _
"You have been assigned a new action item."
.Display
End With
On Error GoTo 0
End If
Next cell
Set OutMail = Nothing
Application.ScreenUpdating = True
End Sub