+ Reply to Thread
Results 1 to 6 of 6

help with VBA conditional notification emails

Hybrid View

  1. #1
    Registered User
    Join Date
    03-08-2025
    Location
    Vancouver, Washington
    MS-Off Ver
    Microsoft 365 apps for business
    Posts
    9

    help with VBA conditional notification emails

    I am new to VBA coding and I have tried to figure this out but my head is starting to hurt so I thought I would ask for help. I want excel to automatically send an email to multiple recipients when the formula in R26 finds the information that meets the correct criteria and populates with data but not when it goes back to an unpopulated cell. I have found a lot of different codes that send different types of emails but I am having a hard time figuring out what each line does and I am not sure how to adapt it to what I want.

  2. #2
    Forum Expert Logit's Avatar
    Join Date
    12-23-2012
    Location
    North Carolina
    MS-Off Ver
    Excel 2019 Professional Plus - 2007 Enterprise
    Posts
    7,388

    Re: help with VBA conditional notification emails

    that meets the correct criteria and populates with data but not when it goes back to an unpopulated cell.
    Does the macro need to check the data for accuracy prior to sending the email/s ... or, can the email/s be sent anytime the cell has data within ?

  3. #3
    Registered User
    Join Date
    03-08-2025
    Location
    Vancouver, Washington
    MS-Off Ver
    Microsoft 365 apps for business
    Posts
    9
    Quote Originally Posted by Logit View Post
    Does the macro need to check the data for accuracy prior to sending the email/s ... or, can the email/s be sent anytime the cell has data within ?
    The email can just be sent. It is for letting the receiver know that they need to check the worksheet.
    Last edited by Coltara; 03-16-2025 at 04:18 AM.

  4. #4
    Forum Expert Logit's Avatar
    Join Date
    12-23-2012
    Location
    North Carolina
    MS-Off Ver
    Excel 2019 Professional Plus - 2007 Enterprise
    Posts
    7,388

    Re: help with VBA conditional notification emails

    Option Explicit
    
    Private Sub Worksheet_Change(ByVal Target As Range)
        Dim rngWatch As Range
        Dim OutApp As Object
        Dim OutMail As Object
        
        'What cell do you care about?
        Set rngWatch = Range("R26")      '<-- Change cell to match your requirements
        
        'What's the criteria?
        If rngWatch.Value <> "" Then     '<-- Change value number to match your requirements
    
            Set OutApp = CreateObject("Outlook.Application")
            Set OutMail = OutApp.CreateItem(0)
        
            On Error Resume Next
            With OutMail
                .to = "YourEmailHere@example.com" '<-- Edit this email address to match your requirements
                .CC = ""
                .BCC = ""
                .Subject = "This is the Subject line"
                .Body = "Number has been reached"
                
                '-- Using .Send auto-emails the message. You do not have an opportunity to review or edit prior to sending
                '--- Using .Display gives you the opportunity to review and edit prior to sending
                '.Send   'or use .Display
                .Display
            End With
            On Error GoTo 0
        
            Set OutMail = Nothing
            Set OutApp = Nothing
        End If
    End Sub

  5. #5
    Registered User
    Join Date
    03-08-2025
    Location
    Vancouver, Washington
    MS-Off Ver
    Microsoft 365 apps for business
    Posts
    9

    Re: help with VBA conditional notification emails

    Thank you so much for your help. I will try it out the next time I go in to work

  6. #6
    Registered User
    Join Date
    03-08-2025
    Location
    Vancouver, Washington
    MS-Off Ver
    Microsoft 365 apps for business
    Posts
    9

    Re: help with VBA conditional notification emails

    alright so I put in the code but nothing happened I tried F5 and ALT+F8 but the option to select it was not there am I missing something?

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. Not receiving notification emails
    By Sintek in forum Excel General
    Replies: 28
    Last Post: 01-16-2017, 06:51 AM
  2. Can excel send an email notification when a conditional format has taken effect.
    By 2Sassy in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 03-21-2016, 06:34 PM
  3. Deadline notification through conditional formating
    By dimitrioskal in forum Excel Formulas & Functions
    Replies: 3
    Last Post: 05-16-2014, 06:20 AM
  4. Conditional Formatting on Due dates and email notification
    By dmallory in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 01-16-2014, 02:55 PM
  5. multiple notification emails
    By Andy Pope in forum Suggestions for Improvement
    Replies: 1
    Last Post: 09-19-2013, 02:18 PM
  6. Replies: 8
    Last Post: 08-31-2013, 03:20 AM
  7. Replies: 4
    Last Post: 01-11-2012, 07:59 PM

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1