Hey there.
I have a database that is configured to reflect when a date for a list of agreements expire. How it works is that when the date of expiry for an agreement has passed, in the column next to the dates (column M) there is an automated change from 'No' to 'Yes' to inform me that the agreement now needs renewal. I am able to send the workbook subsequent to this to all my partners and peers involved as a matter of notification, and this method works just fine. The thing is though that, unless i remember to check the file ever so often, the dates might pass a while before i am able to notify the relevant persons. I would wish to be able to immediately notify them and so want the process of automating my send mail function every time the text changes in Column M from 'No' to 'Yes', indicating expiry.
The macro i have sought to use is this one, but it doesn't work and i'm hoping you guys can fix it and tell me why. Cheers. Thanks in advance!
Private Sub Worksheet_Change(ByVal Target As Range)
Dim iLastRow As Long
Dim i As Long
Application.ScreenUpdating = False
If Not Intersect(Target, Range("M3:M2500")) Is Nothing Then
iLastRow = Cells(Rows.Count, "M").End(xlUp).Row ''''Find Last Row
Dim Rng As Range
For i = iLastRow To 1 Step -1 '''''Start Looking From Bottom Up
If LCase(Cells(i, "M").Value) = "canceled" Then ''Check If Cell M? is equal to 'Yes'"
MsgBox "This code works" 'Call Sub SendMAil()'
End If
Next i
End If
Application.ScreenUpdating = True
I have a database that is configured to reflect when a date for a list of agreements expire. How it works is that when the date of expiry for an agreement has passed, in the column next to the dates (column M) there is an automated change from 'No' to 'Yes' to inform me that the agreement now needs renewal. I am able to send the workbook subsequent to this to all my partners and peers involved as a matter of notification, and this method works just fine. The thing is though that, unless i remember to check the file ever so often, the dates might pass a while before i am able to notify the relevant persons. I would wish to be able to immediately notify them and so want the process of automating my send mail function every time the text changes in Column M from 'No' to 'Yes', indicating expiry.
The macro i have sought to use is this one, but it doesn't work and i'm hoping you guys can fix it and tell me why. Cheers. Thanks in advance!
Private Sub Worksheet_Change(ByVal Target As Range)
Dim iLastRow As Long
Dim i As Long
Application.ScreenUpdating = False
If Not Intersect(Target, Range("M3:M2500")) Is Nothing Then
iLastRow = Cells(Rows.Count, "M").End(xlUp).Row ''''Find Last Row
Dim Rng As Range
For i = iLastRow To 1 Step -1 '''''Start Looking From Bottom Up
If LCase(Cells(i, "M").Value) = "canceled" Then ''Check If Cell M? is equal to 'Yes'"
MsgBox "This code works" 'Call Sub SendMAil()'
End If
Next i
End If
Application.ScreenUpdating = True