Please forgive not asking the right questions, but I have created a basic inventory form that I have triggered to email be based on a cell color being = to 255(red). I have column (A) conditionally formatted to fill red when the Inventory(D) drops below the Reorder point(C). As each line item has a different reorder point, I would like to run this as a range and add the material number(A) to the body of the email based on this being red. Below is what I have thus far, which works for 1 of the cells, but how do I modify to select whichever cell may be red instead of copying and pasting this macro for each line item?
Thank you in advance!
Matt
Thank you in advance!
Matt
Rich (BB code):
Sub low_inventory()
If Range("A:A").Columns(1).Interior.Color = 255 Then
Call Mail_small_Text_Outlook
End If
End Sub
Sub Mail_small_Text_Outlook()
'For Tips see: http://www.rondebruin.nl/win/winmail/Outlook/tips.htm
'Working in Office 2000-2016
Dim OutApp As Object
Dim OutMail As Object
Dim strbody As String
Set OutApp = CreateObject("Outlook.Application")
Set OutMail = OutApp.CreateItem(0)
strbody = "Inventory Is low on Material Number: " & Worksheets("TAG_INV").Range("A:A").Columns(1).Interior.Color = 255
On Error Resume Next
With OutMail
.To = "john.doe@abccompany.com"
.CC = ""
.BCC = ""
.Subject = "Low Inventory"
.Body = strbody
'You can add a file like this
'.Attachments.Add ("C:\test.txt")
.Send 'or use .Display
End With
On Error GoTo 0
Set OutMail = Nothing
Set OutApp = Nothing
End Sub
Last edited by a moderator: