Consulting

Results 1 to 5 of 5

Thread: Solved: Remove blank series from a chart using VBA ?

  1. #1
    VBAX Regular
    Joined
    Apr 2009
    Posts
    36
    Location

    Solved: Remove blank series from a chart using VBA ?

    Hello all,

    I'm desperately trying to make a dynamic scatter plot,
    To generate it, I first need to clear the source data.
    By doing so, I create "blank series" that do a mess in my code.

    I would need to write a code to first delete all blank series from my chart, then I will be able to fill my chart.

    Thanks in advance

  2. #2
    Administrator
    VP-Knowledge Base
    VBAX Grand Master mdmackillop's Avatar
    Joined
    May 2004
    Location
    Scotland
    Posts
    14,489
    Location
    Please post a sample workbook.
    MVP (Excel 2008-2010)

    Post a workbook with sample data and layout if you want a quicker solution.


    To help indent your macros try Smart Indent

    Please remember to mark threads 'Solved'

  3. #3
    VBAX Regular
    Joined
    Apr 2009
    Posts
    36
    Location
    Here is the file:

    Upper graph : 3 series
    Lower graph : 2 series + one blank series because I erased B point's data

    How to clean the <blank series> from the graph ?

    Thanks !

  4. #4
    Dabo.
    Would it not be easier to just delete the series with

    ActiveChart.SeriesCollection("B").Delete
    You can always re-enter it again with something like

    With ActiveChart.SeriesCollection.NewSeries
        .Name = "B"
        .Values = "=ScatterPlot.xls'!B"  'Named Range for series B
    With .Border
        .ColorIndex = 3
        .Weight = xlThin
        .LineStyle = xlContinuous
    End With
    End With
    John

  5. #5
    VBAX Regular
    Joined
    Apr 2009
    Posts
    36
    Location
    Perfect,

    Your idea work :

    first you have to clear the chart (with a macro)
    second you have to clear the series' ranges (that's easy)
    third you have to input the new series' data

    Thanks, it's solved

    solved !

Posting Permissions

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