+ Reply to Thread
Results 1 to 3 of 3

Cannot delete single series from Chart using VBA

  1. #1
    Registered User
    Join Date
    12-15-2006
    Posts
    4

    Cannot delete single series from Chart using VBA

    Hi,
    I'm trying to delete one series from a chart using vba. I turned on the macro recorder and got the following lines of VBA (I'm using Office 2013):

    ActiveChart.FullSeriesCollection(3).Select
    Selection.delete

    When I execute this code it crashes Excel. However, when I put a breakpoint on "Selection.delete" and step through it, series 3 is correctly deleted and then I can continue the macro without problems. Is this a bug in Excel?

    I had something similar working with Office 2010 (ActiveChart.SeriesCollection(3).Delete), but that no longer works and neither has a number of other variations on this theme. Is there another way to delete a single series? In my case it is always series 3.

    Thanks,

    Jim


    Update 1: I've tried just using a two statement macro to delete series 3 from an existing chart with 3 series:

    ActiveChart.FullSeriesCollection(3).Select
    Selection.delete

    The above works. It just doesn't work in my larger program. I've also tried putting the above two lines in a sub routine, but Excel still hangs unless I put a break point on the Selection.delete and step through it and then resume executing.

    Jim
    Last edited by Janodi; 09-27-2014 at 12:00 AM. Reason: Update

  2. #2
    Forum Contributor HerryMarkowitz's Avatar
    Join Date
    09-10-2012
    Location
    Istanbul / Turkey
    MS-Off Ver
    2013 - Win10 - 64bit
    Posts
    1,007

    Re: Cannot delete single series from Chart using VBA

    Please attach an example excel file...
    Sub DontForgetThese()
         If Your thread includes any code Then Please use code tags...
         If Your thread has been solved Then Please mark as solved...
         If Anybody has helped to you Then Please add reputation...
    End Sub

  3. #3
    Spammer
    Join Date
    01-26-2010
    Location
    Worcester MA
    MS-Off Ver
    Excel 2003
    Posts
    184

    Re: Cannot delete single series from Chart using VBA

    Try this:

    ActiveChart.FullSeriesCollection(3).Delete

    If that doesn't do it, try this:

    ActiveChart.SeriesCollection(3).Delete

    The FullSeriesCollection object was introduced in Excel 2013 to enable filtering of the chart without mucking with the data (a great feature), but there may be inconsistencies with how it was implemented in VBA.
    Jon Peltier
    http://PeltierTech.com/

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

Similar Threads

  1. Stacking a single series in a cluster bar chart
    By Bull Run in forum Excel Charting & Pivots
    Replies: 0
    Last Post: 01-10-2014, 04:32 PM
  2. Separate data series in single chart
    By Tensikka in forum Excel Charting & Pivots
    Replies: 2
    Last Post: 12-18-2012, 03:54 AM
  3. Replies: 1
    Last Post: 07-14-2012, 11:46 AM
  4. Select Single Series to Chart
    By rigsby in forum Excel Charting & Pivots
    Replies: 15
    Last Post: 10-06-2009, 08:47 AM
  5. chart data series -- plot a table as a single series
    By hjc in forum Excel Charting & Pivots
    Replies: 7
    Last Post: 09-20-2005, 01:05 PM

Tags for this Thread

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