Make a named ranged of charts visible = true or false

R

Richhall

Hi

I have buttons on a userform for displaying different charts on a
single worksheet. I have grouped different charts together as named
ranges. (i.e Charts_AppMonth is Chart 1, Chart 2, and Chart 3) What
is the syntax please for displaying the range, as I keep getting error
messages. (Compile Error sub or function not defined, over the shapes
bit below and The index into the specified collection is out of bounds
depedning on what I have tried) Here is what I have put currently.

Private Sub AppMonth_Click()

Shapes("Charts_AppMonth").Visible = True
Shapes("Charts_ReqMonth").Visible = False
Shapes("Charts_EnqMonth").Visible = False
Shapes("Charts_AppYear").Visible = False
Shapes("Charts_EnqYear").Visible = False
Shapes("Charts_ReqYear").Visible = False

End Sub

I've tried defining the worksheet, removing the "", putting
Shapes.Range but am not sure as not experienced in Excel VBA. This is
in Excel 2003. I can just define all the objects individually as in
Shapes("Chart 1").Visible=True but was wanting to keep a named range
together.

Can anyone help me please?

Cheers

Rich
 

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