Simplest way to create conditional alerts outside?

Chartist

Board Regular
Joined
Apr 2, 2007
Messages
138
Office Version
  1. 365
Platform
  1. Windows
Based on the data in the sheet, I want to create alerts (email or others).

For example 'when Cell A1 > 10,000' email this address.

What's the easiest way to setup such alerts? Thanks.
 

Excel Facts

Who is Mr Spreadsheet?
Author John Walkenbach was Mr Spreadsheet until his retirement in June 2019.
Hi, you can use VBA to create alert messages.

VBA Code:
Private Sub Worksheet_Change(ByVal Target As Range)
    If Target.Address = "$A$1" And Target.Value > 10000 Then
        MsgBox "Send email"
    End If
End Sub
 
Upvote 0
Hi, you can use VBA to create alert messages.

VBA Code:
Private Sub Worksheet_Change(ByVal Target As Range)
    If Target.Address = "$A$1" And Target.Value > 10000 Then
        MsgBox "Send email"
    End If
End Sub
This will create a popup text 'send email' right? I was askng about actually sending an email :)
 
Upvote 0
Hi,

Added code to send email using outlook:

VBA Code:
Private Sub Worksheet_Change(ByVal Target As Range)
On Error GoTo ErrHandler
    
    Dim objOutlook As Object, objEmail As Object, lastRow As Byte, counter As Byte
    If Target.Address = "$A$1" And Target.Value > 10000 Then   
    '**** Initialize Outlook
    Set objOutlook = CreateObject("Outlook.Application")
    
    '**** Create Outlook EMAIL Object.
    Set objEmail = objOutlook.CreateItem(olMailItem)
  
    With objEmail
                .To = "abc@yahoo.com"
                .Subject = "Excel"
                .Body = "Hi" 
                .send
    End With

    '***** Clear the MEMORY.
    Set objEmail = Nothing:    Set objOutlook = Nothing
        
    Exit Sub
ErrHandler:
    MsgBox "Unable to send email.
    End If
End Sub
 
Upvote 0
Hi,

Added code to send email using outlook:

VBA Code:
Private Sub Worksheet_Change(ByVal Target As Range)
On Error GoTo ErrHandler
   
    Dim objOutlook As Object, objEmail As Object, lastRow As Byte, counter As Byte
    If Target.Address = "$A$1" And Target.Value > 10000 Then  
    '**** Initialize Outlook
    Set objOutlook = CreateObject("Outlook.Application")
   
    '**** Create Outlook EMAIL Object.
    Set objEmail = objOutlook.CreateItem(olMailItem)
 
    With objEmail
                .To = "abc@yahoo.com"
                .Subject = "Excel"
                .Body = "Hi"
                .send
    End With

    '***** Clear the MEMORY.
    Set objEmail = Nothing:    Set objOutlook = Nothing
       
    Exit Sub
ErrHandler:
    MsgBox "Unable to send email.
    End If
End Sub
Thanks, is there a way to get this to work with gmail (without Outlook)? Also, can the data be broadcast in other ways, like social media?
 
Upvote 0

Forum statistics

Threads
1,214,875
Messages
6,122,040
Members
449,063
Latest member
ak94

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top