Macro needed to email based on data in cell

jjhags56

New Member
Joined
Jan 22, 2018
Messages
1
Hoping someone can help. I need an email to be generated based on data in multiple cells. Basically a range of cells.

Currently this is what I have:
Private Sub worksheet_change(ByVal Target As Range)
If Range("O6").Value = "X" 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 = "XXXX -" & vbNewLine & vbNewLine & _
" Request Ready for approval" & vbNewLine & _
Range("A6").Value & vbNewLine & vbNewLine & vbNewLine & vbNewLine & vbNewLine & _


On Error Resume Next
With xOutMail
.To = "xxxxx@xxxxxx.com"
.CC = "xxxxxxx@xxxxxx.com"
.BCC = ""
.Subject = "PLEASE APPROVE: Request " & Range("A6").Value
.Body = xMailBody

.Display 'or use .Send
End With
On Error GoTo 0
Set xOutMail = Nothing
Set xOutApp = Nothing
End Sub

I can get this to work for one cell (O6), but I want this to include cells O6:O36. And then I also want the same for column P. My problem is getting this macro to work on multiple cells.

Someone please help, spent way too much time on this.
 

Excel Facts

How to show all formulas in Excel?
Press Ctrl+` to show all formulas. Press it again to toggle back to numbers. The grave accent is often under the tilde on US keyboards.

Forum statistics

Threads
1,224,827
Messages
6,181,195
Members
453,021
Latest member
pingpong7117

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