PC Review


Reply
Thread Tools Rate Thread

How to deteremine the number of trendline in chart?

 
 
Danny
Guest
Posts: n/a
 
      21st Oct 2009
Hi, I have a lot of charts (say ~110 charts) and would like to delete
all the trendline. However, the number of each chart may not be same.
Therefore, I need to determine the number of trendline by every chart.
Can commend to do it?
 
Reply With Quote
 
 
 
 
Jon Peltier
Guest
Posts: n/a
 
      21st Oct 2009
This procedure will remove all trendlines in all embedded charts and
chart sheets in the active workbook:


Sub KillTrendlines()
Dim sh As Object
Dim chtob As ChartObject
Dim cht As Chart
Dim srs As Series
Dim tr As Trendline

For Each sh In ActiveWorkbook.Sheets
For Each chtob In ws.ChartObjects
For Each srs In chtob.Chart.SeriesCollection
For Each tr In srs.Trendlines
tr.Delete
Next
Next
Next
Next

For Each cht In ActiveWorkbook.Charts
For Each srs In cht.SeriesCollection
For Each tr In srs.Trendlines
tr.Delete
Next
Next
Next

End Sub


- Jon
-------
Jon Peltier
Peltier Technical Services, Inc.
http://peltiertech.com/



Danny wrote:
> Hi, I have a lot of charts (say ~110 charts) and would like to delete
> all the trendline. However, the number of each chart may not be same.
> Therefore, I need to determine the number of trendline by every chart.
> Can commend to do it?

 
Reply With Quote
 
Danny
Guest
Posts: n/a
 
      23rd Oct 2009
On Oct 22, 6:32*am, Jon Peltier <jo...@SPAMpeltiertech.com> wrote:
> This procedure will remove all trendlines in all embedded charts and
> chart sheets in the active workbook:
>
> Sub KillTrendlines()
> * *Dim sh As Object
> * *Dim chtob As ChartObject
> * *Dim cht As Chart
> * *Dim srs As Series
> * *Dim tr As Trendline
>
> * *For Each sh In ActiveWorkbook.Sheets
> * * *For Each chtob In ws.ChartObjects
> * * * *For Each srs In chtob.Chart.SeriesCollection
> * * * * *For Each tr In srs.Trendlines
> * * * * * *tr.Delete
> * * * * *Next
> * * * *Next
> * * *Next
> * *Next
>
> * *For Each cht In ActiveWorkbook.Charts
> * * *For Each srs In cht.SeriesCollection
> * * * *For Each tr In srs.Trendlines
> * * * * *tr.Delete
> * * * *Next
> * * *Next
> * *Next
>
> End Sub
>
> - Jon
> -------
> Jon Peltier
> Peltier Technical Services, Inc.http://peltiertech.com/
>
>
>
> Danny wrote:
> > Hi, I have a lot of charts (say ~110 charts) and would like to delete
> > all the trendline. However, the number of each chart may not be same.
> > Therefore, I need to determine the number of trendline by every chart.
> > Can commend to do it?- Hide quoted text -

>
> - Show quoted text -


It works, Thanks.
 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

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


Similar Threads
Thread Thread Starter Forum Replies Last Post
Chart trendline rwfreeman Microsoft Access Reports 1 18th May 2008 03:43 AM
How do I add a trendline to a chart? =?Utf-8?B?VmFsZXJpYW4=?= Microsoft Access Getting Started 6 21st Jul 2006 12:12 AM
Trendline and 3-D chart sudhanshu Microsoft Excel Misc 1 23rd Jan 2004 02:30 AM
Trendline in chart sudhanshu Microsoft Excel Misc 1 10th Jan 2004 07:01 PM
Can't Add TrendLine to Bar Chart Casey Microsoft Access Reports 0 9th Oct 2003 06:20 PM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 07:42 PM.