Excel VBA Line Color / Marker Line Color showed the difference between Format.Line.ForeColor.RGB
and MarkerForegroundColor
, and I found that Format.Line.ForeColor.RGB
influences MarkerForegroundColor
.
Sub color_border()
With ActiveChart.FullSeriesCollection(1)
.MarkerForegroundColor = RGB(255, 0, 0)
.Format.Line.ForeColor.RGB = RGB(0, 0, 255)
End With
End Sub
Do I need to always MarkerForegroundColor
to countermand Format.Line.ForeColor.RGB
? How can I separately change Format.Line.ForeColor.RGB
not affecting MarkerForegroundColor
?
What I need is Format.Line.Visible = msoFalse
for not Format.Line
but MarkerForegroundColor
only, but it seems impossible.
Updated: This is my code.
Sub BlueDotRedLine()
ActiveChart.FullSeriesCollection(1).MarkerBackgroundColor = RGB(0, 0, 255)
ActiveChart.FullSeriesCollection(1).MarkerForegroundColor = xlNone
ActiveChart.FullSeriesCollection(1).Format.Line.ForeColor.RGB = RGB(255, 0, 0)
End Sub
Sub RedLineBlueDot()
ActiveChart.FullSeriesCollection(1).Format.Line.ForeColor.RGB = RGB(255, 0, 0)
ActiveChart.FullSeriesCollection(1).MarkerBackgroundColor = RGB(0, 0, 255)
ActiveChart.FullSeriesCollection(1).MarkerForegroundColor = xlNone
End Sub
These are the results. BlueDotRedLine
applies white borders around markers. RedLineBlueDot
applies red borders around markers. I need markers have no line—the bottom-right one.