View Single Post
  #3   Report Post  
Posted to microsoft.public.excel.programming
Danny[_13_] Danny[_13_] is offline
external usenet poster
 
Posts: 16
Default How to deteremine the number of trendline in chart?

On Oct 22, 6:32*am, Jon Peltier 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.