PC Review


Reply
Thread Tools Rate Thread

Hiding & Unhiding graphs...

 
 
Ray
Guest
Posts: n/a
 
      21st Feb 2007
Hello -

I've got a sheet that contains 4 graphs -- the graphs are already
built and update fine. Rather than have 4 small graphs or make users
switch sheets, I want to use a spin-button to let them scroll through
the graphs.

I've inserted the spin-button and linked it to cell T2 -- available
values are 1-4 and is working properly. However, I can get the graphs
to hide/unhide when T2 changes. I tried this out on two of the
graphs, code below:
***************
Private Sub Worksheet_Change(ByVal Target As Excel.Range)

If Target.Address = "$t$2" Then
Application.EnableEvents = False
If Target.Value = 1 Then
ActiveSheet.ChartObjects("Chart 1").Visible = True
ActiveSheet.ChartObjects("Chart 7").Visible = False
Else
ActiveSheet.ChartObjects("Chart 7").Visible = True
ActiveSheet.ChartObjects("Chart 1").Visible = False
End If
Application.EnableEvents = True
End If

*****************

What am I doing wrong? Remember that I also need to modify the code
to rotate through all 4 of the graphs.

AND, is there a way to make the the spin-button 'scroll' through the
values? So, it would go 1-2-3-4-1-2-3-4? Right now, it only goes
1-2-3-4-3-2-1-2...

TIA,
Ray

 
Reply With Quote
 
 
 
 
=?Utf-8?B?U2hhbmVEZXZlbnNoaXJl?=
Guest
Posts: n/a
 
      21st Feb 2007
Are all 4 charts different charts or do you plot each area depending on the
value of the spinner? I'm not a 100% sure what your data area looks like,
but one way to do this is to set up a single range for plotting whose
formulas change to pick up the data for the appropriate chart. You can use
an OFFSET, INDEX or INDIRECT function for this purpose. Then the spinner
value controls one of the arguments for these functions, picking up the
appropriate data. Now to hide the chart all together will be easy because
there is only one chart.

It sounds like your charts overlay each other, that would not be necessary
with the above approach. Also the above means there is no code necessary
except if you don't want to see any charts.


--
Cheers,
Shane Devenshire


"Ray" wrote:

> Hello -
>
> I've got a sheet that contains 4 graphs -- the graphs are already
> built and update fine. Rather than have 4 small graphs or make users
> switch sheets, I want to use a spin-button to let them scroll through
> the graphs.
>
> I've inserted the spin-button and linked it to cell T2 -- available
> values are 1-4 and is working properly. However, I can get the graphs
> to hide/unhide when T2 changes. I tried this out on two of the
> graphs, code below:
> ***************
> Private Sub Worksheet_Change(ByVal Target As Excel.Range)
>
> If Target.Address = "$t$2" Then
> Application.EnableEvents = False
> If Target.Value = 1 Then
> ActiveSheet.ChartObjects("Chart 1").Visible = True
> ActiveSheet.ChartObjects("Chart 7").Visible = False
> Else
> ActiveSheet.ChartObjects("Chart 7").Visible = True
> ActiveSheet.ChartObjects("Chart 1").Visible = False
> End If
> Application.EnableEvents = True
> End If
>
> *****************
>
> What am I doing wrong? Remember that I also need to modify the code
> to rotate through all 4 of the graphs.
>
> AND, is there a way to make the the spin-button 'scroll' through the
> values? So, it would go 1-2-3-4-1-2-3-4? Right now, it only goes
> 1-2-3-4-3-2-1-2...
>
> TIA,
> Ray
>
>

 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Hiding/unhiding XP partitions =?Utf-8?B?TWFydGluZWxsaXM=?= Windows XP Security 0 9th Sep 2004 01:19 PM
Hiding/unhiding files from the desktop Lemon Jelly Windows XP General 1 23rd May 2004 09:49 AM
Hiding and unhiding columns using vba? Rick Microsoft Excel Discussion 5 10th Mar 2004 12:24 AM
Re: Hiding & Unhiding Columns Dave Peterson Microsoft Excel Discussion 1 3rd Mar 2004 04:50 AM
Hiding/Unhiding Columns Mike Microsoft Excel Discussion 3 22nd Nov 2003 07:40 PM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 09:50 PM.