I have 2 charts (one an XY Scatter and one a Line plot) and a worksheet in a workbook. Depending on the value of a cell in the workbook I want one or the other chart to be visible. I have the event trapping working correctly so I know when the appropriate cell value changes. I also have the following (simplified) code on the worksheet's code page that isn't behaving correctly:
Private Sub Worksheet_Change(ByVal Target As Range)
'Code that makes sure the target is the right cell is delete for simplicity
Select Case Targe.Value
Case 1
Charts("B").Visible = False
Charts("A").Visible = True
Case 2
Charts("A").Visible = False
Charts("B").Visible = True
End Select
End If
End Sub
The code properly hides chart "B" (the Line plot) if both charts are visible and Target = 1. And it properly shows chart "A" (the XY Scatter plot) if "B" is showing and Target = 1. However, it won't show (visible = True) chart "B" or Hide "A". I know for a fact that it is stepping through the Case = 2 statements but appears to be ignoring the code.
Any suggestions for what might be happening?
Thanks
Sean
Bookmarks