+ Reply to Thread
Results 1 to 2 of 2

Two beginner's question (:)

  1. #1
    rookievestor
    Guest

    Two beginner's question (:)

    Dear all,

    Is there a way to create a list of all dataseries of a chart and output
    their names to excel? I want to create a list of checkboxes dynamically for
    a chart based on user selection...

    Regarding pivot table, can I remove all formula/data from a pivot table by
    code? For example, I want to add some metric to a pivot table based on
    selection on a userform..first, I got to remove all existing data/formula
    from the table. Also, do you know is it possible to change a pivot table's
    name programmingly?

    Thank you for your posting!



  2. #2
    Shawn O'Donnell
    Guest

    RE: Two beginner's question (:)

    x"rookievestor" wrote:
    > Is there a way to create a list of all dataseries of a chart and output
    > their names to excel? I want to create a list of checkboxes dynamically for
    > a chart based on user selection...


    What exactly do you want to do here? Draw a chart based on the user's
    selection of which series should be plotted? In that case, you would want to
    make a list of possible ranges to include in the chart, present the options
    to the user, then draw the chart based on the response.

    If you start with names of series from an existing chart, you can only
    remove items from that list. That is, there's no "Visible" property that I
    know of that you can use to hide a series, so you can't just turn one on or
    off. Once you delete a series, it won't be there the next time you want to
    present options to the user. Is that what you want?

    Maybe I misunderstand what you're trying to do. In any case, here's
    something to get you started down the chart-to-series path:

    Dim chartSeries as Variant
    ...
    Worksheets("Sheet1").ChartObjects("Chart 1").Activate
    For Each chartSeries In ActiveChart.SeriesCollection
    Debug.Print chartSeries.Name
    Next

    You can access the SeriesCollection this way, too:

    Worksheets("Sheet1").ChartObjects("Chart 1").Chart.SeriesCollection

    The trick there is to recognize that a ChartObject contains a Chart. It
    isn't the Chart itself.

    To get started with code going in the other direction, try recording macros
    while you make charts with different data series included.


+ 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