I have a scatter chart with multiple series and a trendline per series. I want to set the trendline datalable to be the same color as the series' fill color. The series' fill color is Automatic. The .MarkerBackgroundColor
property returns -1 for all series while the .MarkerBackgroundColorIndex
returns 2 for all series. I believe this only happens if the marker fill is set to Automatic. However, I can't change that because the series in the chart get added through another VBA code based on dynamic data. Any help?
For i = 1 To Sheet1.ChartObjects("Chart 5").Chart.SeriesCollection.Count
With Sheet1.ChartObjects("Chart 5").Chart.FullSeriesCollection(i)
.Trendlines(1).DataLabel.Format.Fill.ForeColor.RGB = .MarkerBackgroundColor
End With
Next i