Switching between two charts based on check / control box

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.
 
P

Patrick Molloy

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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top