One of my protected worksheets has an embedded line chart, as well as button-activated macros that allow users (most in Excel ‘07 or ‘10, some in ‘03) to add or remove the trendline for each of the several data series. I can add a trendline, but would appreciate your suggestions as to how to subsequently remove it.
Successful Add:
Unsuccessful Remove attempt:With ActiveSheet.ChartObjects(1).Chart.SeriesCollection(7).Trendlines.Add
Results in: Run-Time error '438': Object doesn’t support this property or method.With ActiveSheet.ChartObjects(1).Chart.SeriesCollection(7).Trendlines.Remove
I’m a novice VBA user working in Excel 2010. Thanks for considering this!
Last edited by RandyV; 05-16-2011 at 02:10 PM. Reason: found solution elsewhere
Hey Randy, you can use ActiveChart.SetElement (msoElementTrendlineNone) to remove a trend line from a graph.
You need to provide an index,
activechart.SeriesCollection(1).trendlines(1).delete
There are currently 1 users browsing this thread. (0 members and 1 guests)
Bookmarks