Jed Shields
Active Member
- Joined
- Sep 7, 2011
- Messages
- 283
- Office Version
- 365
- Platform
- Windows
Hello all,
I've got two option buttons that are linked to cell V1, giving a 1 or 2 depending on which button is pressed. If the top button is pressed the I want to hide Chart 2. If the bottom button is pressed the I want to show Chart 2. ChartOnOff works perfectly if I manually run it but I can't ge it to run automatically when the cell value changes. Any ideas?
I've got two option buttons that are linked to cell V1, giving a 1 or 2 depending on which button is pressed. If the top button is pressed the I want to hide Chart 2. If the bottom button is pressed the I want to show Chart 2. ChartOnOff works perfectly if I manually run it but I can't ge it to run automatically when the cell value changes. Any ideas?
Code:
Private Sub Worksheet_Change(ByVal Target As Range)
If Not Intersect(Target, Target.Worksheet.Range("V1")) Is Nothing Then ChartOnOff
End Sub
Sub ChartOnOff()
'Application.ScreenUpdating = False
If Sheet19.Range("v1") = "1" Then
Chart2FormatRemove
End If
If Sheet19.Range("v1") = "2" Then
Chart2FormatAdd
End If
End Sub
Sub Chart2FormatRemove()
ChartObjects("chart 2").Visible = False
End Sub
Sub Chart2FormatAdd()
ChartObjects("chart 2").Visible = True
End Sub
Last edited: