clearing seriescollections

Jackeb

Board Regular
Joined
Mar 20, 2002
Messages
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
 

Excel Facts

Select a hidden cell
Somehide hide payroll data in column G? Press F5. Type G1. Enter. Look in formula bar while you arrow down through G.
because i didn't know that this would work.... i shall now try that one...

select the chart area or the whole cahrt?
 
Upvote 0

Forum statistics

Threads
1,214,606
Messages
6,120,487
Members
448,967
Latest member
visheshkotha

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top