Reputation: 1
I need help tracking old and new values in two cells of a worksheet.
For example cell A10
has an Y/N switch and cell B10
has a formula output as value.
If A10="Y"
and cell B10
has changed, then I will trigger a macro named Ballooning
.
If A10="N"
, and B10
has changed, then there will not be any action.
If I change A10="Y"
again and even if there is no change in B10
, the macro Ballooning
has to trigger. However no other worksheet or workbook change should trigger the Ballooning
macro.
Upvotes: 0
Views: 88
Reputation: 31394
Try this in your code behind your sheet:
Private Sub Worksheet_Change(ByVal Target As Range)
'Check if Cell B10 in current sheet changed and A10 is Y
If Range(Target.Address) = Range("B10") And Range("A10").Value = "Y" Then
Call Ballooning
End If
'Check if A10 changed to Y
If Range(Target.Address) = Range("A10") And Range("A10").Value = "Y" Then
Call Ballooning
End If
End Sub
Upvotes: 0