I google'd the code to run a macro depending on a met condition, but I can't seem to make it work properly. Can anyone help? Here's the code that I got:
If I change AG6 to 1 manually, the above macro works fine. But I have a formula in AG6 that is "=IF(AF6=1, 1, ""). Is there any way to launch a macro if the AG6 cell becomes 1 from the formula (ie formula is TRUE)?
Code:
Private Sub Worksheet_Change(ByVal Target As Range)
If Intersect(Target, Range("AG6")) Is Nothing Then
Exit Sub
End If
If Range("AG6") = 1 Then
SomeMacro
End If
End Sub
Sub SomeMacro()
MsgBox ("Hi!")
End Sub
If I change AG6 to 1 manually, the above macro works fine. But I have a formula in AG6 that is "=IF(AF6=1, 1, ""). Is there any way to launch a macro if the AG6 cell becomes 1 from the formula (ie formula is TRUE)?