Switching between two charts based on check / control box

  • Thread starter Thread starter Hannes
  • Start date Start date
H

Hannes

Hi there,

I please need some support on how can I create a check or control box in a
spreadsheet which allows to switch between two charts.
For instance, checking shows chart A at the specific location in the
spreadsheet, unchecking shows chart B at the same location.

Many thanks for support.
 
using a FORMs checkbox, I have C3 as the linked cell and I set the control to
run this macro:

Option Explicit

Sub ShowChart()
Dim ch1 As ChartObject
Dim ch2 As ChartObject
Set ch1 = ActiveSheet.ChartObjects("Chart 1")
Set ch2 = ActiveSheet.ChartObjects("Chart 2")
ch1.Visible = Range("C3")
ch2.Visible = Not ch1.Visible
End Sub
 
Back
Top