ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Delete chart series (https://www.excelbanter.com/excel-programming/438747-delete-chart-series.html)

brg

Delete chart series
 
I am having a problem deleting a chart series. The series contains a zero
value. The chart is a log-log plot. I am using the following code to try
and delete the series.

Activesheet.Seriescollection().Delete

I get the error:

Delete method of Series class failed.

The code works if there are no zero values in the series. Any help would be
greatly appreciated.

--
BRG

Andy Pope

Delete chart series
 
Hi,

Sometimes it helps to change the chart type of the series to a column
chart before deleting the series.

Application.DisplayAlerts = False
With ActiveChart.SeriesCollection(1)
.ChartType = 51
.Delete
End With
Application.DisplayAlerts = True

If the chart only has 1 series you will need to set the chart type back
to original type when adding new series.

Cheers
Andy

BRG wrote:
I am having a problem deleting a chart series. The series contains a zero
value. The chart is a log-log plot. I am using the following code to try
and delete the series.

Activesheet.Seriescollection().Delete

I get the error:

Delete method of Series class failed.

The code works if there are no zero values in the series. Any help would be
greatly appreciated.


--

Andy Pope, Microsoft MVP - Excel
http://www.andypope.info

brg

Delete chart series
 
Thanks Andy, that did the trick.
--
BRG


"Andy Pope" wrote:

Hi,

Sometimes it helps to change the chart type of the series to a column
chart before deleting the series.

Application.DisplayAlerts = False
With ActiveChart.SeriesCollection(1)
.ChartType = 51
.Delete
End With
Application.DisplayAlerts = True

If the chart only has 1 series you will need to set the chart type back
to original type when adding new series.

Cheers
Andy

BRG wrote:
I am having a problem deleting a chart series. The series contains a zero
value. The chart is a log-log plot. I am using the following code to try
and delete the series.

Activesheet.Seriescollection().Delete

I get the error:

Delete method of Series class failed.

The code works if there are no zero values in the series. Any help would be
greatly appreciated.


--

Andy Pope, Microsoft MVP - Excel
http://www.andypope.info
.



All times are GMT +1. The time now is 09:30 PM.

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