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 emailHi, 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
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?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