Hi, I originally had an excel workbook with multiple sheets and each sheet had a macro to automatically generate an Outlook email if a cell in a certain column contained a specific value. I have to essentially re-create the workbook with all of the information on one sheet, but I would still like the macro to work on multiple columns within the same sheet. However, I cannot figure out how to properly duplicate the macro to continue running on the same sheet for multiple columns. If anyone can please help me with this I would really appreciate it. The code for a single column is below. Thank you in advance!
Dim xRg As Range
Private Sub Worksheet_Change(ByVal Target As Range)
If Target.Cells.Count > 1 Then Exit Sub
If Not Intersect(Target, Range("I4:I1000")) Is Nothing Then
If UCase(Target.Value) = "YES" Then
Mail_small_Text_Outlook Target.row
End If
End If
End Sub
Sub Mail_small_Text_Outlook(ByVal row As Long)
Dim xOutApp As Object
Dim xOutMail As Object
Dim xMailBody As String
Set xOutApp = CreateObject("Outlook.Application")
Set xOutMail = xOutApp.CreateItem(0)
xMailBody = ""
On Error Resume Next
With xOutMail
.To = ""
.CC = ""
.BCC = ""
.Subject = ""
.Body = xMailBody
.Display 'or use .Send
End With
On Error GoTo 0
End Sub
Bookmarks