Home |
Search |
Today's Posts |
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Hi,
I just recorded a simple macro that is supposed to deleta a series of data from a chart. The thing is that sometimes I have a number of series on the same chart and I was to delete them with only one macro. Sub Hreinsa() ActiveSheet.ChartObjects("Chart 10").Activate ActiveChart.ChartArea.Select Application.Run "OnGenericSetSheetActive" ActiveChart.SeriesCollection(1).Delete End Sub How can I delete all the series on the chart. Hope anyone can help. Thanks! |
#2
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
This will delete all the series from the active chart:
Sub DeleteSeries() If Not ActiveChart Is Nothing Then ActiveChart.SeriesCollection.Delete End If End Sub - Jon ------- Jon Peltier, Microsoft Excel MVP http://www.geocities.com/jonpeltier/Excel/index.html _______ Sverrir wrote: Hi, I just recorded a simple macro that is supposed to deleta a series of data from a chart. The thing is that sometimes I have a number of series on the same chart and I was to delete them with only one macro. Sub Hreinsa() ActiveSheet.ChartObjects("Chart 10").Activate ActiveChart.ChartArea.Select Application.Run "OnGenericSetSheetActive" ActiveChart.SeriesCollection(1).Delete End Sub How can I delete all the series on the chart. Hope anyone can help. Thanks! |
#3
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Oops, spoke too soon. You need to loop through the series:
Sub DeleteSeriesCollection() Dim i As Integer If Not ActiveChart Is Nothing Then For i = ActiveChart.SeriesCollection.Count To 1 Step -1 ActiveChart.SeriesCollection(i).Delete Next End If End Sub - Jon ------- Jon Peltier, Microsoft Excel MVP http://www.geocities.com/jonpeltier/Excel/index.html _______ Sverrir wrote: Hi, I just recorded a simple macro that is supposed to deleta a series of data from a chart. The thing is that sometimes I have a number of series on the same chart and I was to delete them with only one macro. Sub Hreinsa() ActiveSheet.ChartObjects("Chart 10").Activate ActiveChart.ChartArea.Select Application.Run "OnGenericSetSheetActive" ActiveChart.SeriesCollection(1).Delete End Sub How can I delete all the series on the chart. Hope anyone can help. Thanks! |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
charts toolbar / charts disappeared | Charts and Charting in Excel | |||
link excel charts to web pages and update charts automatically | Charts and Charting in Excel | |||
Charts - How to have multiple charts share a legend. | Charts and Charting in Excel | |||
interactive charts for stacked bar charts | Charts and Charting in Excel | |||
Matching the colors Column Charts and Pie Charts | Charts and Charting in Excel |