I have a working VBA Macro that sends an email if the value in column I changes. How do I change this so that it sends a different email to someone else if the value in Column M changes?
This is a snippet of my current code. Do I create another "Private Sub"? or just repeat what I need before the "End Sub" and redefine the range to "M:M"?
Private Sub Worksheet_Change(ByVal Target As Range)
On Error Resume Next
If Target.Cells.Count > 1 Then Exit Sub
Set xRg = Intersect(Range("I:I"), Target)
If xRg Is Nothing Then Exit Sub
Dim xOutApp As Object
Dim xOutMail As Object
Dim xMailBody As String
Dim R As Long
......
With xOutMail
.To = "email address"
.CC = ""
.BCC = ""
.Subject = "For Your Review"
' .Body = FileType & ": " & Filename & " has been submitted for your Review by " & Originator
.Body = xMailBody
.Display 'or use .Send
End With
On Error GoTo 0
Set xOutMail = Nothing
Set xOutApp = Nothing
End Sub
This is a snippet of my current code. Do I create another "Private Sub"? or just repeat what I need before the "End Sub" and redefine the range to "M:M"?
Private Sub Worksheet_Change(ByVal Target As Range)
On Error Resume Next
If Target.Cells.Count > 1 Then Exit Sub
Set xRg = Intersect(Range("I:I"), Target)
If xRg Is Nothing Then Exit Sub
Dim xOutApp As Object
Dim xOutMail As Object
Dim xMailBody As String
Dim R As Long
......
With xOutMail
.To = "email address"
.CC = ""
.BCC = ""
.Subject = "For Your Review"
' .Body = FileType & ": " & Filename & " has been submitted for your Review by " & Originator
.Body = xMailBody
.Display 'or use .Send
End With
On Error GoTo 0
Set xOutMail = Nothing
Set xOutApp = Nothing
End Sub