Trigger Macro by change in formula value within a cell
I wish to trigger a macro by a change in a formula value within a particular cell. I am totally green in this area, however searching through the internet came across the following script which partly solved my problem:
Dim O18Val
Private Sub Worksheet_Activate()
O18Val = [O18]
End Sub
Private Sub Worksheet_Calculate()
If [O18] <> O18Val Then
MsgBox "XXXXXXXX"
Application.EnableEvents = False
'run code here
Application.EnableEvents = True
O18Val = [O18]
End If
End Sub
The above script gives the message "XXXXXXXX" when the formula value of cell O18 changes.
Now I wish to extend the above script for other cells as well.
E.g. If formula value of cell O19 changes, a message "YYYYYYYYY" pops up.
Any ideas please? Thanks