[h=2]
Show Shapes Based on Cell Value[/h]

Advertisement
I want to show and hide shapes on a sheet based on the cell value >1. If cell A1 = 1 the shape should be visible and for value is 0, the shape should be hidden. I thought this would be fairly straight forward but the following code is not working.
Private Sub Worksheet_Calculate()
If Range("A1").Value = 1 Then
ActiveSheet.Shapes("Oval 1").Visible = True
Else
ActiveSheet.Shapes("Oval 1").Visible = False
End If
If Range("A2").Value = 1 Then
ActiveSheet.Shapes("Oval 2").Visible = True
Else
ActiveSheet.Shapes("Oval 2").Visible = False
End If
End Sub
Private Sub Worksheet_Calculate()
If Range("A1").Value = 1 Then
ActiveSheet.Shapes("Oval 1").Visible = True
Else
ActiveSheet.Shapes("Oval 1").Visible = False
End If
If Range("A2").Value = 1 Then
ActiveSheet.Shapes("Oval 2").Visible = True
Else
ActiveSheet.Shapes("Oval 2").Visible = False
End If
End Sub