hi
a couple of questions
- do you want to send a separate email to all the cells in red, or a single email containing the content of all the cells in red?
- if the former, where are the email addresses stored?
otherwise, the macro below will copy the content of every red cell into a text string and send it to the named recipient.
note that a lot of colours could be considered "red". the macro assumes the cell is pure red, i.e. RGB (255,0,0). If you are using a different shade of red, you will need to tweak the macro.
Sub RedCellsEmail()
Dim CCell As Range, txt As String, MyApp As Outlook.Application, MyMail As Outlook.MailItem
Set MyApp = CreateObject("outlook.Application")
Set MyMail = MyApp.CreateItem(olMailItem)
txt = ""
For Each CCell In ActiveSheet.UsedRange.Cells
If CCell.Interior.Color = RGB(255, 0, 0) Then
txt = txt & CCell & Chr(10)
End If
Next CCell
With MyMail
.To = "someone@somewhere.com"
.cc = ""
.BCC = ""
.Subject = "this is the subject"
.Body = txt
.Display 'or use .send
End With
Set MyMail = Nothing
Set MyApp = Nothing
End Sub
p.s. you will need to have the Outlook object library selected under tools > references in the VBA area for this to work
Bookmarks