Akashwani
Well-known Member
- Joined
- Mar 14, 2009
- Messages
- 2,911
Good day,
I am sending an email when the value of a cell changes, http://www.rondebruin.nl/mail/change.htm
I am using the following code in my worksheet....
My Macro code..
What I would like to do is increase the range that this applies to.
Range from AE7 to Range Y3:AE250.
I would like to Include the Range A3:A250 in the subject/body.
So If AE7 has changed, A7 (along with some text "This cell has changed, do X Y Z") would be somewhere within the email.
I hope that is clear and possible!
Ak
I am sending an email when the value of a cell changes, http://www.rondebruin.nl/mail/change.htm
I am using the following code in my worksheet....
Code:
Private Sub Worksheet_Change(ByVal Target As Range)
Dim rng As Range
If Target.Cells.Count > 1 Then Exit Sub
On Error GoTo EndMacro
If Not Target.HasFormula Then
Set rng = Target.Dependents
If Not Intersect(Range("AE7"), rng) Is Nothing Then
If Range("AE7").Value < 20 Then EmailOut 'MyMacroName
End If
End If
EndMacro:
End Sub
My Macro code..
Code:
Sub EmailOut ()
Dim OutApp As Object
Dim OutMail As Object
Dim strto As String, strcc As String, strbcc As String
Dim strsub As String, strbody As String
Set OutApp = CreateObject("Outlook.Application")
OutApp.Session.Logon
Set OutMail = OutApp.CreateItem(0)
strto = "[EMAIL="Ak@XYZ.com"]Ak@XYZ.com[/EMAIL]"
strcc = ""
strbcc = ""
strsub = "Testing email send"
strbody = "Using EmailOut" & vbNewLine & vbNewLine & _
"Cell AE7 has changed"
With OutMail
.To = strto
.CC = strcc
.BCC = strbcc
.Subject = strsub
.Body = strbody
.Send
End With
Set OutMail = Nothing
Set OutApp = Nothing
End Sub
What I would like to do is increase the range that this applies to.
Range from AE7 to Range Y3:AE250.
I would like to Include the Range A3:A250 in the subject/body.
So If AE7 has changed, A7 (along with some text "This cell has changed, do X Y Z") would be somewhere within the email.
I hope that is clear and possible!
Ak