Extract Non-Blank Cells & copy row into a email

mikey141

New Member
Joined
May 14, 2015
Messages
11
Reminder Emails via Outlook
I'm new at this and been looking around for ages to get the right code and wondered if someone can help please?

I have a sheet that I've setup to auto send a email when column "M" has the word "Reminder" inserted by another VBA command. What I want to do is copy multiple rows into the body of email if the word "Reminder" or non-blank is located in column (M3:M500)

I.E.
If "Reminder" in range (M3:M500) Then copy (B8:K8)

Below is the code for sending the basic email
Sub SendReminderMail()
Dim OutlookApp As Object
Dim OutLookMailItem As Object
Dim icounter As Integer
Dim MailDest As String




Set OutlookApp = CreateObject("Outlook.application")
Set OutLookMailItem = OutlookApp.CreateItem(0)


With OutLookMailItem
MailDest = ""
For icounter = 1 To WorksheetFunction.CountA(Columns(14))
If MailDest = "" And Cells(icounter, 14).Offset(0, -1) = "Reminder" Then
MailDest = Cells(icounter, 14).Value
ElseIf MailDest <> "" And Cells(icounter, 14).Offset(0, -1) = "Reminder" Then
MailDest = MailDest & ";" & Cells(icounter, 14).Value
End If
Next icounter


.To = MailDest
.Subject = "Risk Assessment Reminder" & Cells(icounter, 2)
.Body = "Reminder of your next Risk Assessment"
.Display
'.Send
End With


Set OutLookMailItem = Nothing
Set OutlookApp = Nothing
End Sub
 

Excel Facts

Last used cell?
Press Ctrl+End to move to what Excel thinks is the last used cell.

Forum statistics

Threads
1,214,642
Messages
6,120,701
Members
448,980
Latest member
CarlosWin

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