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
- seriesChart.Select
- With Selection
- .MarkerStyle = 8
- .MarkerSize = 4
- .MarkerForegroundColor = RGB(0, 0, 0)
- End With
- ''
- Next seriesChart
- End Sub
Description:
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:
You can find similar Excel Questions and Answer hereunder
1) How do i put double quotes in a string in vba in Excel
2) How can I list all files in a folder using VBA?
3) How do I copy a Table from one location to another and retain all formulas, formats and columnwidths?
4) How can I shade alternate rows in color using VBA to make it easier to read voluminous data running into hundreds of rows?
5) How can I save a WorkSheet as a new WorkBook using VBA?
6) How to create charts in Excel VBA
7) How do I add a symbol like Triangle / Inverted Triangle for indicating trends in a cell using VBA?
8) Here some explanations about the MSXML who stands for Microsoft XML core services
9) Vba list all files in a folder in Excel
10) How do I update my DropDown list whenever the sheet is activated?