Dear VBA Experts,
I've wrote a simple VBA code - the aim is to make a shape UP visible whenever the value next to the shape is above 0, and to make the shape DN visible whenever the value is below 0.
The problem is that if I change the A1 cell value manually - the macro works well and the shape is displayed properly.
But if I use excel formula to set the A1 cell value [=IF(A2>0,1,2)] and then change the A2 value - it does not work. What shall I change?
Please, find my macro below.
I've wrote a simple VBA code - the aim is to make a shape UP visible whenever the value next to the shape is above 0, and to make the shape DN visible whenever the value is below 0.
The problem is that if I change the A1 cell value manually - the macro works well and the shape is displayed properly.
But if I use excel formula to set the A1 cell value [=IF(A2>0,1,2)] and then change the A2 value - it does not work. What shall I change?
Please, find my macro below.
Code:
Private Sub Worksheet_Change(ByVal Target As Range)
If Target.Address(0, 0) = "A1" Then
If Target.Value = 1 Then
ActiveSheet.Shapes("Up").Visible = True
ActiveSheet.Shapes("Dn").Visible = False
Else
ActiveSheet.Shapes("Up").Visible = False
ActiveSheet.Shapes("Dn").Visible = True
End If
End If
End Sub