I have written code to email a recipient where "yes" appears in Col G. Where "Yes" Appears in Col "G", then I want the header as well as the rows "Yes" to be emailed to the recipient"
I cannot get the code to do this
See full code below
See link for sample data
https://www.dropbox.com/s/rjqsnkgpb8gj19p/Email Reminder based on Date.xlsm?dl=0
It would be appreciated if someone could assist me
I have also posted on link below
https://www.excelforum.com/excel-pr...omaticaly-send-email-based-on-renew-date.html
I cannot get the code to do this
See full code below
Code:
Sub Email_Reminder()
Dim Email_Subject As String, Email_Send_To As String, Email_Body As String
Dim Mail_Object As Object, Mail_Single As Variant
Dim r As Long
Dim cell As Range
r = 2
Do Until Trim(Cells(r, 7).Value) = ""
Email_Subject = Sheets("Email").Range("B1")
Email_Send_To = Cells(r, 6).Value
Email_Body = Sheets("Email").Range("B2")
For Each cell In Columns("G:G")
If cell.Value = "Yes" Then
On Error GoTo debugs
Set Mail_Object = CreateObject("Outlook.Application")
Set Mail_Single = Mail_Object.CreateItem(0)
With Mail_Single
.Subject = Email_Subject
.To = Email_Send_To
.Body = Email_Body
.Display
End With
End If
ResumeLoop:
Next cell
Loop
Exit Sub
debugs:
If Err.Description <> "" Then MsgBox Err.Description
GoTo ResumeLoop:
End Sub
See link for sample data
https://www.dropbox.com/s/rjqsnkgpb8gj19p/Email Reminder based on Date.xlsm?dl=0
It would be appreciated if someone could assist me
I have also posted on link below
https://www.excelforum.com/excel-pr...omaticaly-send-email-based-on-renew-date.html