+ Reply to Thread
Results 1 to 3 of 3

Showing/Hiding Chart Based on Cell Value

  1. #1
    Registered User
    Join Date
    01-07-2005
    Location
    Seattle, WA
    Posts
    18

    Showing/Hiding Chart Based on Cell Value

    I have 2 charts (one an XY Scatter and one a Line plot) and a worksheet in a workbook. Depending on the value of a cell in the workbook I want one or the other chart to be visible. I have the event trapping working correctly so I know when the appropriate cell value changes. I also have the following (simplified) code on the worksheet's code page that isn't behaving correctly:

    Private Sub Worksheet_Change(ByVal Target As Range)
    'Code that makes sure the target is the right cell is delete for simplicity
    Select Case Targe.Value
    Case 1
    Charts("B").Visible = False
    Charts("A").Visible = True
    Case 2
    Charts("A").Visible = False
    Charts("B").Visible = True
    End Select
    End If
    End Sub

    The code properly hides chart "B" (the Line plot) if both charts are visible and Target = 1. And it properly shows chart "A" (the XY Scatter plot) if "B" is showing and Target = 1. However, it won't show (visible = True) chart "B" or Hide "A". I know for a fact that it is stepping through the Case = 2 statements but appears to be ignoring the code.

    Any suggestions for what might be happening?
    Thanks
    Sean

  2. #2
    Forum Contributor
    Join Date
    06-10-2004
    Location
    India
    Posts
    1,066
    your piece of code works fine for me.

    - Mangesh

  3. #3
    Registered User
    Join Date
    01-07-2005
    Location
    Seattle, WA
    Posts
    18

    You're kidding?!?

    It switches the visible graph back and forth?
    Uggh.
    Maybe my computer is tired.

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1