Vba change marker size and color in Excel
For example, I have a Chart ("Chart1") comparing the sales figures of 3 Salespersons - I want to set the Marker Size to "4", Marker Type to "Round" and Marker Line Color to "Black" for all the 3 series in Chart.
To do it in Excel, here is the answer:
- Option Explicit
- Sub MarkerSettingsUpdate()
- Dim seriesChart As Series
- For Each seriesChart In ActiveSheet.ChartObjects("Chart1").Chart.SeriesCollection
- With Selection
- .MarkerStyle = 8
- .MarkerSize = 4
- .MarkerForegroundColor = RGB(0, 0, 0)
- End With
- Next seriesChart
- End Sub
a) Line 5 loops through all series in Chart1.
b) Line 8 , Line 9 and Line 10 sets the Marker properties for the selected series.
Result after Macro execution: