I've got a chart in excell with some trendlines. THey are however in the
legend in the wrong order. Is it possible to change the order of the
trendlines in the legend?
Hi,
Looks like the order of trendlines is simply the order they were added
and once added, unlike the normal chart series, you can not change the
order.
Cheers
Andy
dutchy wrote:
> I've got a chart in excell with some trendlines. THey are however in the
> legend in the wrong order. Is it possible to change the order of the
> trendlines in the legend?
--
Andy Pope, Microsoft MVP - Excel
http://www.andypope.info
Actually they only follow the order that they were created until you close and reopen the file (or copy and paste the chart). After that they will be arranged according to the data series order. (Select any data series in the chart > right click > format data series > series order).
you can create right order by using vba code.
ActiveSheet.Shapes.AddChart
Worksheets("sheet1").ChartObjects(1).Activate
ActiveChart.Axes(xlValue).MajorGridlines.Select
ActiveChart.PlotArea.Select
With ActiveChart
.ChartArea.Left = 350
.ChartArea.Top = 150
.ChartType = xlLineMarkers
' add series from selected range, column by column
.SeriesCollection.NewSeries
With .SeriesCollection(1)
.Values = Worksheets("sheet1").Range("$C$4:$C$45")
.XValues = Worksheets("sheet1").Range("$A$4:$A$45")
.Name = "val"
End With
With .SeriesCollection(2)
.Values = Worksheets("sheet1").Range("$D$4:$D$45")
.XValues = Worksheets("sheet1").Range("$A$4:$A$45")
.Name = "val"
End With
'...
End With
Egonomist,
I doubt the OP will read your answer after 5 years.
Furthermore,
Your post does not comply with Rule 3 of our Forum RULES. Use code tags around code. Posting code without them makes your code hard to read and difficult to be copied for testing. Highlight your code and click the # at the top of your post window. For more information about these and other tags, found here
Quoting entire posts clutters the forum and makes threads hard to read !
If you are pleased with a member's answer then use the Star icon to rate it
Click here to see forum rules
There are currently 1 users browsing this thread. (0 members and 1 guests)
Bookmarks