+ Reply to Thread
Results 1 to 2 of 2

Adding data series to chart via macro

  1. #1
    JessK
    Guest

    Adding data series to chart via macro

    I have a macro that adds rows of data to a summary table. I would like to
    update my chart by adding a new series for each new row of data, but the
    ActiveChart.SeriesCollection(N) command will not accept a variable for N.

    for example, the command will add Data series # 3 with N=3, but if I create
    a variable "run_num" set equal to the # of the current data series (ie,
    run_num = Range("A5").Value), then the command does not work.

    How can this be done so that the added series increments each time the macro
    adds a new row of data?


  2. #2
    Jon Peltier
    Guest

    Re: Adding data series to chart via macro

    That line of code should be fine. You didn't share with us the code leading
    up to it, the error description, the value of N, the number of series in the
    chart (did you make sure you have at least N series?), the data in the
    source data range.

    There are some VBA-Chart code examples on this web page which you may find
    helpful:

    http://peltiertech.com/Excel/ChartsH...kChartVBA.html

    - Jon
    -------
    Jon Peltier, Microsoft Excel MVP
    Peltier Technical Services
    Tutorials and Custom Solutions
    http://PeltierTech.com/
    _______

    "JessK" <[email protected]> wrote in message
    news:[email protected]...
    >I have a macro that adds rows of data to a summary table. I would like to
    > update my chart by adding a new series for each new row of data, but the
    > ActiveChart.SeriesCollection(N) command will not accept a variable for N.
    >
    > for example, the command will add Data series # 3 with N=3, but if I
    > create
    > a variable "run_num" set equal to the # of the current data series (ie,
    > run_num = Range("A5").Value), then the command does not work.
    >
    > How can this be done so that the added series increments each time the
    > macro
    > adds a new row of data?
    >




+ 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