I want to hide chart for a particular value but make it visible for other values. Data for my chart is from cell(A,3) to cell(k,10). Value of cell(A,3) is dynamic. As such, I want chart to be hidden for a particular value of A3. I tried this code but it doesn't work:
Sub chart_visibility()
Application.ScreenUpdating = False
ActiveWorkbook.Sheets("Sheet1").Activate
If Range("A3").Value = "STATE_PROVINCE" Then
ActiveSheet.ChartObjects("Chart 2").Visible = False
Else
ActiveSheet.ChartObjects("Chart 2").Visible = True
End If
Application.ScreenUpdating = True
End Sub
Quoting DDuffy here, the command ActiveSheet.ChartObjects("Chart 2").Visible = False
should hide your chart.
I don't really know why even after Application.ScreenUpdating = True
it wouldn't hide the chart. For me this seems to work just as well.
Maybe someone else got an Idea?