![]() |
How to deteremine the number of trendline in chart?
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? |
How to deteremine the number of trendline in chart?
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? |
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. |
All times are GMT +1. The time now is 01:59 PM. |
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com