• Hi All

    Please note that at the Chandoo.org Forums there is Zero Tolerance to Spam

    Post Spam and you Will Be Deleted as a User

    Hui...

  • When starting a new post, to receive a quicker and more targeted answer, Please include a sample file in the initial post.

Macro-VBA trigger

karlbf

New Member
I have a spreadsheet with a couple of "if" statements on it and I need a Macro/VBA to trigger sending an email to a prearranged person if the word "DUE" appears on the sheet as a result of the if statements. Is this possible ?
 
... one possible to do like next:
Code:
Private Sub Worksheet_Change(ByVal Target As Range)
    Application.ScreenUpdating = False
    Application.EnableEvents = False
    With ActiveSheet
        y_max = .Range("A1").CurrentRegion.Rows.Count
        x_max = .Range("A1").CurrentRegion.Columns.Count
        For y = 1 To y_max
            For x = 1 To x_max
                If .Cells(y, x) = "DUE" Then
                    If WorksheetFunction.Find("IF", .Cells(y, x).Formula, 1) > 0 Then
'   Write here Your code to send email...
                    End If
                End If
            Next x
        Next y
    End With
    Application.EnableEvents = True
    Application.ScreenUpdating = True
End Sub
 
Back
Top