• Auto email notifications based on excel cell values with different cell values

    Home » Forums » AskWoody support » Productivity software by function » Visual Basic for Applications » Auto email notifications based on excel cell values with different cell values

    • This topic has 0 replies, 1 voice, and was last updated 8 years ago.
    Author
    Topic
    #1772869

    Hello,
    I have been doing a lot of reading on this and found myself successful but not! What I am trying to do is on sheet1 cell D5 value less than value 65 to email me telling me that Patty Press stock is low. With this in mind I can get this to work fine. My issue is trying to get other cells to do the same thing with different values. For example: I would like sheet1 cell D5 to email me when it gets below 65 telling me that patty presses are low, and sheet1 cell D6 to email me when it gets below 25 telling me that patty smashers are low in stock. I have about 50 or more items to monitor all with different values. I have posted below what I have gotten to work for just one item but cannot figure out how to do multiple items with different values. I am using Win10 with office2010. I think since there are more than one chance of a value change reminder per session I might want it to send when closing the spreadsheet. Any help would be much appreciated as I am very new to this level of excel.

    Private Sub Worksheet_Change(ByVal Target As Range)

    If ActiveSheet.Range(“D5”).Value < 25 Then

    Dim OutApp As Object
    Dim OutMail As Object
    Dim strbody As String

    Set OutApp = CreateObject("Outlook.Application")
    Set OutMail = OutApp.CreateItem(0)

    strbody = "Patty Press stock is below 65 "

    On Error Resume Next
    With OutMail
    .To = "timmytoo@whatever.com"
    .CC = ""
    .BCC = ""
    .Subject = "Patty Press stock needs attention"
    .Body = strbody

    .Send
    End With
    On Error GoTo 0

    Set OutMail = Nothing
    Set OutApp = Nothing

    End If
    End Sub

    Thank you in advance for taking time to look into this.

    Bocephusva

    Reply To: Auto email notifications based on excel cell values with different cell values

    You can use BBCodes to format your content.
    Your account can't use all available BBCodes, they will be stripped before saving.

    Your information: