i have a macro to send an email if is date, i need to correct or add conditions but dont know how. i tried and just ruined the entire book
i need that if column 6 a- is date or b-"WITHDRAWN" or c-"ON HOLD" that the message is activated
i need that if column 6 a- is date or b-"WITHDRAWN" or c-"ON HOLD" that the message is activated
Rich (BB code):
Private Sub Worksheet_Change(ByVal Target As Range)
If Target.Cells.Count = 1 Then
If Target.Column = 6 And Target.Value <> "" Then
If IsDate(ActiveCell) Then
result = MsgBox("pressing OK will send email to notify", vbOK + vbExclamation, "Termination")
If result = vbOK Then
Set OutlookApp = CreateObject("Outlook.Application")
Set OlObjects = OutlookApp.GetNamespace("MAPI")
Set newmsg = OutlookApp.CreateItem(olMailItem)
With newmsg
.Recipients.Add ("me@me.org") ' Add Recipients
.Subject = Cells(Target.Row, "A").Value & " has been terminated." ' Add Subject
.Body = Cells(Target.Row, "A").Value & " has been terminated on" & " " & Cells(Target.Row, "F").Value ' Email Body
.Display 'Display Email
.Send 'Send Email
End With
MsgBox "Outlook message sent", , "Outlook message sent" ' Confirm Sent Email
End If
End If
End If
End If
End Sub