Sub Total()
ActiveChart.ClearToMatchStyle
ActiveChart.ChartStyle = 227
ActiveSheet.ChartObjects("Chart 19").Activate
ActiveChart.Legend.Select
ActiveChart.Legend.LegendEntries(1).Select
With Selection.Format.Line
.Visible = msoTrue
.ForeColor.ObjectThemeColor = msoThemeColorText1
.ForeColor.TintAndShade = 0
.ForeColor.Brightness = 0
.Transparency = 0
End With
ActiveChart.Legend.LegendEntries(5).Select
With Selection.Format.Line
.Visible = msoTrue
.ForeColor.RGB = RGB(255, 255, 0)
.Transparency = 0
End With
ActiveChart.Legend.LegendEntries(6).Select
With Selection.Format.Line
.Visible = msoTrue
.ForeColor.RGB = RGB(0, 176, 80)
.Transparency = 0
End With
End Sub
I tried to recreate this macro multiple times to mould it to my need, so I ran it once to test it and it broke once it got to the With Selection.Format.Line
, giving me this error. Which part of the macro is causing this error?
Edit: Shai Rado posted perfect fix Recorded macro breaks on Legend formatting