Excel how to add in my email body the value of a certain cell.

AerowindowsRobin

New Member
Joined
Oct 1, 2021
Messages
3
Office Version
  1. 2019
Platform
  1. Windows
Hello,

Below is my VBA code that when a number is above 5 in my "U" column it generates an email to my company. The email of my body currently says "Workflow in the CRF Tracker has passed 5 business days on PO#" and I want it to display the PO# that's in Column "A". Example, if "U5" > 5, an email body would display "Workflow in the CRF Tracker has passed 5 business days on PO#" & [A5].

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("U:U"), Target)
If xRg Is Nothing Then Exit Sub
If IsNumeric(Target.Value) And Target.Value > 5 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)
strbody = "Workflow in the CRF Tracker has passed 5 business days on PO#" & ???
On Error Resume Next
With xOutMail
.To = ""
.CC = ""
.BCC = ""
.Subject = "Workflow in CRF"
.HTMLBody = strbody
.Display
End With
On Error GoTo 0
Set xOutMail = Nothing
Set xOutApp = Nothing
End Sub
 

Excel Facts

Highlight Duplicates
Home, Conditional Formatting, Highlight Cells, Duplicate records, OK to add pink formatting to any duplicates in selected range.
VBA Code:
strbody = "Workflow in the CRF Tracker has passed 5 business days on PO#" & Range("A5").Value
 
Upvote 0
VBA Code:
strbody = "Workflow in the CRF Tracker has passed 5 business days on PO#" & Range("A5").Value
Thanks for the response, but I don't want it for that specific cell. It was an example, if my cell in "U8" goes above 5 I want to generate the value from "A8". The next day is my cell in "U9" goes above 5 I want to generate the value from "A9" onto my email body and so on.
 
Upvote 0
This Forum does not provide that service. You'll need to post on a Cloud website and provide the link here.
 
Upvote 0

Forum statistics

Threads
1,215,059
Messages
6,122,913
Members
449,093
Latest member
dbomb1414

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