+ Reply to Thread
Results 1 to 2 of 2

Hide & Unhide Charts

Hybrid View

  1. #1
    vvaidya@pol.net
    Guest

    Hide & Unhide Charts

    Hello:

    I would appreciate help with the following:
    I have about 5 different charts on a worksheet. Is there a way that I
    can hide/unhide the charts so that I can display only one at a time.
    I plan to use a List through 'Data', 'Validation', so that the user can
    select the chart to be viewed from a drop down list (eg. Chart1,
    Chart2,...... Chart5)

    Thus when the user selects say Chart 2 from the drop down list, Chart2
    is displayed & other charts are hidden.

    TIA

    Vinay


  2. #2
    Rowan Drummond
    Guest

    Re: Hide & Unhide Charts

    Try:

    Private Sub Worksheet_Change(ByVal Target As Range)
    Dim chrt As ChartObject
    If Target.Count = 1 And Target.Address = "$F$1" Then
    For Each chrt In ActiveSheet.ChartObjects
    If chrt.Name <> Target.Value Then
    chrt.Visible = False
    Else
    chrt.Visible = True
    End If
    Next chrt
    End If
    End Sub

    This is worksheet event code. Right click the sheet tab, select View
    Code and paste the code in there.
    I have assumed that the Data Validation cell is in F1 - change as
    required. Your list of names will need to match the names of the charts
    exactly. If you have used the default names the probably "Chart 1",
    "Chart 2" etc.

    Hope this helps
    Rowan

    vvaidya@pol.net wrote:
    > Hello:
    >
    > I would appreciate help with the following:
    > I have about 5 different charts on a worksheet. Is there a way that I
    > can hide/unhide the charts so that I can display only one at a time.
    > I plan to use a List through 'Data', 'Validation', so that the user can
    > select the chart to be viewed from a drop down list (eg. Chart1,
    > Chart2,...... Chart5)
    >
    > Thus when the user selects say Chart 2 from the drop down list, Chart2
    > is displayed & other charts are hidden.
    >
    > TIA
    >
    > Vinay
    >


+ 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