![]() |
![]() |
|
|||||||
| Excel Questions All Excel/VBA questions - formulas, macros, pivot tables, general help, etc. Please post to this forum in English only. |
![]() |
|
|
Thread Tools | Display Modes |
|
|
#1 |
|
Board Regular
Join Date: Mar 2002
Posts: 81
|
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 |
|
MrExcel MVP
Join Date: Feb 2002
Location: Austin, Texas USA
Posts: 11,654
|
Why wouldn't you just select the chart and use...
Selection.ClearContents |
|
|
|
|
|
#3 |
|
Board Regular
Join Date: Mar 2002
Posts: 81
|
because i didn't know that this would work.... i shall now try that one...
select the chart area or the whole cahrt? |
|
|
|
![]() |
| Bookmarks |
| Thread Tools | |
| Display Modes | |
|
|