vba change marker size and color in Excel

Q183. In Excel, how can I change the Marker size and Marker line color for all the series in a chart?

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.

excel vba change marker size and color

To do it in Excel, here is the answer:

  1. Option Explicit
  2. Sub MarkerSettingsUpdate()
  3. Dim seriesChart As Series
  4. ''
  5. For Each seriesChart In ActiveSheet.ChartObjects("Chart1").Chart.SeriesCollection
  6. seriesChart.Select
  7. With Selection
  8. .MarkerStyle = 8
  9. .MarkerSize = 4
  10. .MarkerForegroundColor = RGB(0, 0, 0)
  11. End With
  12. ''
  13. Next seriesChart
  14. 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:

excel excel vba change marker size and color

 

You can find similar Excel Questions and Answer hereunder

1) How can I add a Timestamp after macro execution?

2) How do I assign a macro to a shape using VBA?

3) How can I delete all shapes in a WorkSheet?

4) Vba list all files in a folder in Excel

5) How can I get input from user through a prompt and assign user's input to a cell?

6) How can I dynamically add a hyperlink using VBA?

7) To easily identify sheets belonging to different Business Divisions, I would like to color code tab names - is it possible?

8) How can I hide Formula Bar and Headings using VBA?

9) How can I get the count of number of series in a Chart using VBA?

10) How can I get users to select a file for processing using my macro?

11) How do I update my DropDown list whenever the sheet is activated?

12) How do i put double quotes in a string in vba in Excel

13) How can I clear cell after activating a routine when there is a change in value of a cell?

14) Vba delete entire row if contains certain text in Excel

15) Vba code to password protect workbook in Excel