#1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Charts

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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 90
Default Charts

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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 90
Default Charts

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
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
charts toolbar / charts disappeared Pro Charts and Charting in Excel 0 December 18th 09 01:31 AM
link excel charts to web pages and update charts automatically Signguy Charts and Charting in Excel 1 April 22nd 08 08:29 PM
Charts - How to have multiple charts share a legend. Sean Charts and Charting in Excel 2 November 20th 07 04:49 AM
interactive charts for stacked bar charts [email protected] Charts and Charting in Excel 4 December 28th 06 09:58 PM
Matching the colors Column Charts and Pie Charts RohanSewgobind Charts and Charting in Excel 3 April 21st 06 09:35 PM


All times are GMT +1. The time now is 02:11 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"