PDA

View Full Version : Solved: Do a Visible and Invisible Graph



Ricardo Rosa
10-07-2005, 08:55 AM
Hi !!!!:beerchug:

I want to do some alterations in the file and a need some help...
First:
In the cell C4 and C5 I want to introduce something that only allows to place a X... or place an X in cell C4 or in Cell C5... the person can not put two cell at the same time.

Second:
The letters in red must be invisible and blocked

Third:
Everything the rest must be visible but blocked, in a way the n that nobody can change

Last and more difficult,
If the cell C4 has a X, then just appears the graph 2 and the graph 1 disappears
If the cell C5 has a X, then only appears the fr?fico 1 and the graph two disappears

Please look at the attach file....

Thankssssssssssss

:beerchug:

Ricardo Rosa
10-07-2005, 09:08 AM
sorry, i forgot to say that:

the cells in yellow are for the person to fill, i want they be visible and not blocked.

sorryyyyyy

Thanks

:beerchug:

Shazam
10-07-2005, 09:05 PM
Hi Ricardo Rosa,


Well I did everything you ask for except I can't figuer it out how to to hide the charts. I'm just a youngster in VBA I was getting closes but I'm missing something. I also updated your chart creating a OFFSET range for your chart. So if you enter your data say in cell K19 and L19 it will automatically update your chart. Well here is the code that it suppose to hide the chart but maybe someone on this forum could help you with that.

See the attachment!:hi:




Private Sub Worksheet_Change(ByVal Target As Range)
If Target.Address = "$C$4" Then
ActiveSheet.ChartObjects("Chart 1").Visible = True
On Error Resume Next
ActiveSheet.ChartObjects("Chart 1").Visible = False
If Target.Address = "$C$5" Then
ActiveSheet.ChartObjects("Chart 2").Visible = True
On Error Resume Next
ActiveSheet.ChartObjects("Chart 2").Visible = False

End If
End Sub

Shazam
10-09-2005, 01:02 PM
Well I found another solution. You have data by Day how about by Month also? I added the Month data next to Day data in your worksheet. So If you put X in cell C4 the chart will displays the Day data.

But

If you put an X in C5 it will dsiplays Month data. So you dont need 2 charts in the worksheet just 1 chart.

Let me know what you think?

See the Attachment!:rotlaugh:

xCav8r
10-09-2005, 08:39 PM
Note: I edited this thread to reduce the case of the title from ALL CAPS to Title Case.

Shazam
10-12-2005, 06:24 AM
Ok I finally Figuered it out. This is how it works.

In Cell C4 has a "X" it will hide chart 3 But if you delete the "X" in cell C4 it will hide Chart 1 and Unhide Chart 3. The chart you have is defaulted as Chart 3 thats why I could not get it to work. Here is the the code.



Private Sub Worksheet_Change(ByVal Target As Excel.Range)

If Worksheets("Sheet1").Range("C4") = "X" Then
ActiveSheet.ChartObjects("chart 1").Visible = True
ActiveSheet.ChartObjects("chart 3").Visible = False
Else
ActiveSheet.ChartObjects("chart 1").Visible = False
ActiveSheet.ChartObjects("chart 3").Visible = True
End If
End Sub

Ricardo Rosa
10-12-2005, 06:31 AM
Hi,

yes!!! it's done... your code works in perfection...

I'm just arrived from a small vacation, that's why i'm just reply now...

Thanks:beerchug: