Greetings,
I have a PO log sheet in excel. I want this excel sheet to automatically e-mail a user a list of open PO's, as long as conditions are met.
The sheet has many columns, but of importance is column A, column C, Column O, and Column Q.
In column A, the date the PO was submitted is listed.
In column C, the PO# is listed.
In column O, the date received is listed. If not received yet, cell is blank.
In Column Q, I have a simple ifand function which returns 1 if PO has not been received and it was submitted 30 days or more ago. It returns 0 if not.
I would like the sheet to email the list of PO's that have not been received and are 30 days or older (AKA column Q will return 1).
Currently, this is my VBA code (which I've basically copied and modified very slightly):
Dim xRg As Range
'Update by Extendoffice 2018/3/7
Private Sub Worksheet_Change(ByVal Target As Range)
On Error Resume Next
If Target.Cells.Count > 1 Then Exit Sub
Set xRg = Intersect(Range("Q190"), Target)
If xRg Is Nothing Then Exit Sub
If IsNumeric(Target.Value) And Target.Value > 0 Then
Call Mail_small_Text_Outlook
End If
End Sub
Sub Mail_small_Text_Outlook()
Dim xOutApp As Object
Dim xOutMail As Object
Dim xMailBody As String
Set xOutApp = CreateObject("Outlook.Application")
Set xOutMail = xOutApp.CreateItem(0)
xMailBody = "Please followup on PO Number" & Range("C190").Value
On Error Resume Next
With xOutMail
.To = "xxxxxx@xxxxxxxx; xxxxxxx@xxxxxxxx"
.CC = ""
.BCC = ""
.Subject = "Please follow up on PO" & Range("C190").Value
.Body = xMailBody
.Display 'or use .Send
End With
On Error GoTo 0
Set xOutMail = Nothing
Set xOutApp = Nothing
End Sub
This works for basically one row (row 190). As mentioned, I would like it to scan the entire column Q, and send a list with all PO, not just the one cell.
Very grateful for any help or guidance. Thank you.
I have a PO log sheet in excel. I want this excel sheet to automatically e-mail a user a list of open PO's, as long as conditions are met.
The sheet has many columns, but of importance is column A, column C, Column O, and Column Q.
In column A, the date the PO was submitted is listed.
In column C, the PO# is listed.
In column O, the date received is listed. If not received yet, cell is blank.
In Column Q, I have a simple ifand function which returns 1 if PO has not been received and it was submitted 30 days or more ago. It returns 0 if not.
I would like the sheet to email the list of PO's that have not been received and are 30 days or older (AKA column Q will return 1).
Currently, this is my VBA code (which I've basically copied and modified very slightly):
Dim xRg As Range
'Update by Extendoffice 2018/3/7
Private Sub Worksheet_Change(ByVal Target As Range)
On Error Resume Next
If Target.Cells.Count > 1 Then Exit Sub
Set xRg = Intersect(Range("Q190"), Target)
If xRg Is Nothing Then Exit Sub
If IsNumeric(Target.Value) And Target.Value > 0 Then
Call Mail_small_Text_Outlook
End If
End Sub
Sub Mail_small_Text_Outlook()
Dim xOutApp As Object
Dim xOutMail As Object
Dim xMailBody As String
Set xOutApp = CreateObject("Outlook.Application")
Set xOutMail = xOutApp.CreateItem(0)
xMailBody = "Please followup on PO Number" & Range("C190").Value
On Error Resume Next
With xOutMail
.To = "xxxxxx@xxxxxxxx; xxxxxxx@xxxxxxxx"
.CC = ""
.BCC = ""
.Subject = "Please follow up on PO" & Range("C190").Value
.Body = xMailBody
.Display 'or use .Send
End With
On Error GoTo 0
Set xOutMail = Nothing
Set xOutApp = Nothing
End Sub
This works for basically one row (row 190). As mentioned, I would like it to scan the entire column Q, and send a list with all PO, not just the one cell.
Very grateful for any help or guidance. Thank you.