Guinaba
Board Regular
- Joined
- Sep 19, 2018
- Messages
- 217
- Office Version
- 2016
- Platform
- Windows
Hi guys,
I used two have two buttons (Form Control) to show/hide a chart named ("Graph") which was perfectly working. However, I've decided to replace the two buttons with a toggle button (ActiveX Control) and now I keep getting the error: The item with the specified name wasn't found, I am assuming the button doesn's recognize the chart("Graph"). Any suggestions?
I used two have two buttons (Form Control) to show/hide a chart named ("Graph") which was perfectly working. However, I've decided to replace the two buttons with a toggle button (ActiveX Control) and now I keep getting the error: The item with the specified name wasn't found, I am assuming the button doesn's recognize the chart("Graph"). Any suggestions?
VBA Code:
Private Sub ToggleButton2_Click()
With ToggleButton2
If .Value=true Then
.Caption = "Hide Graph"
.BackColor = vbRed
Sheets("Summary").ChartObjects("Graph").Visible = True
Sheets("Summary").ChartObjects("Graph").Activate
Sheets("Summary").ChartObjects("Graph").Cut
Sheets("Summary").Paste
Sheets("Summary").ChartObjects("Graph").Height = 460
Sheets("Summary").ChartObjects("Graph").Width = 1300
Growth.Show vbModeless
Growth.StartUpPosition = 0
Growth.Top = Application.Top + 50
Growth.Left = Application.Left + Application.Width - Growth.Width - 400
Else
.Caption = "Show Graph"
.BackColor = vbGreen
Sheets("Summary").ChartObjects("Graph").Visible = False
Growth.Hide
Unload Growth
End If
End With