Error Checking in Excel
Thanks Thanks:  0
Likes Likes:  0
Results 1 to 3 of 3

Thread: clearing seriescollections

  1. #1
    Board Regular
    Join Date
    Mar 2002
    Posts
    81
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Default


    does anyone have a handy code that will cycle through every series collection within a selected chart and "empty" it.. ie delete all of them??

    the code i have at the moment is:

    Sub emptychart()
    Dim scol As Integer, i As Integer

    scol = ActiveChart.seriescollection.count

    If scol = 0 Then
    Exit Sub
    Else

    Do Until scol = 0
    ActiveChart.seriescollection(1).Delete
    scol = scol - 1
    Loop
    End If

    End Sub


    but it falls over very easily.. i don't know why but when you go to manually delete the series collections then the only one left is called series2... but if u recode deleting it the line is:

    ActiveChart.seriescollection(1).Delete

    so it should have no problem....

    this one has really got me stumped!!

    any help...????

    Cheers

    Ed

  2. #2
    MrExcel MVP
    Join Date
    Feb 2002
    Location
    Austin, Texas USA
    Posts
    11,654
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Default

    Why wouldn't you just select the chart and use...

    Selection.ClearContents

  3. #3
    Board Regular
    Join Date
    Mar 2002
    Posts
    81
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Default

    because i didn't know that this would work.... i shall now try that one...

    select the chart area or the whole cahrt?

Some videos you may like

User Tag List

Like this thread? Share it with others

Like this thread? Share it with others

Posting Permissions

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