ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Charts and Charting in Excel (https://www.excelbanter.com/charts-charting-excel/)
-   -   Removing a serie in a chart (https://www.excelbanter.com/charts-charting-excel/28508-removing-serie-chart.html)

Renaud

Removing a serie in a chart (VBA)
 
Hello,

I'm trying to make a vba script that replaces the series in a graph by other series. The problem is that I cannot find a method to remove a serie from a seriescollection (I find a method to add a new one, but not to remove an old one). The add method had an argument that allows the replacement of serie by the new one, but the number of series varies, so I cannot use it.

I also saw that the object series responds to the 'Delete' method, but I did not find how to use it.

Thanks in advance,

Renaud

Renaud

I'm answering to myself. I finally found. Here is the solution:

Code:

While Charts("Chart1").SeriesCollection.Count 0
    Charts("Chart1").SeriesCollection.Item(1).Delete
Wend

But if you've better ideas, i'm taker.

Renaud


All times are GMT +1. The time now is 07:12 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com