VBA & Macro Problems

How to Set Markers on an Excel Combo Chart Series Using VBA

Adam DavisAdam Davis Oct 26, 2026 868 views

Question details

The user needs to set markers on an Excel combo chart series using VBA, but the MarkerStyle property is being ignored.

How to Set Markers on an Excel Combo Chart Series Using VBA
Product
Excel
Device & OS
not provided
Scenario
Writing VBA macros to format a combo chart, specifically aiming to add markers to a data series that uses a secondary axis.
Observed behavior
The VBA code runs without errors but fails to apply the MarkerStyle property to the series, even though the same markers can be successfully added manually through the user interface.
Before you start

Ensure your workbook is saved in a macro-enabled format (.xlsm) and that you have enabled macros in your Trust Center settings before running or testing VBA scripts.

Solution 1Recommended

Verify Chart Type and Target Specific Series Explicitly

Ensure you are targeting the exact series object and enforcing the correct chart type before applying marker properties.

When working with combo charts, especially those utilizing secondary axes, VBA can sometimes fail to apply marker properties if the chart type of the specific series isn't explicitly defined first. A series might default to a state that doesn't support markers until explicitly told to behave like a line chart with markers.

1
Define the Chart Object

Begin by explicitly defining the chart object in your VBA code, for example: Set myChart = ActiveSheet.ChartObjects("Chart 1").Chart

2
Target the Specific Series

Specify the exact series index within the combo chart that requires markers: Set mySeries = myChart.SeriesCollection(2)

3
Enforce Chart Type

Ensure the series chart type is explicitly set to a line with markers before applying styles: mySeries.ChartType = xlLineMarkers

4
Apply Marker Properties

Assign the MarkerStyle, MarkerSize, and MarkerForegroundColor properties directly to the targeted series object.

Verify Chart Type and Target Specific Series Explicitly
Combo Chart Limitations: If setting the property still has no effect after explicitly targeting the series, consult Microsoft Developer documentation, as certain complex combo-chart configurations have strict rendering limits in VBA.
Advanced VBA Support in WPS

Create and Format Charts with Macros in WPS Spreadsheet

WPS Spreadsheet offers robust VBA and macro support, allowing you to easily automate complex formatting tasks like adding markers, managing combo charts, and handling secondary axes seamlessly.

  1. 1. Open Your Workbook: Launch WPS Spreadsheet and open your .xlsm macro-enabled file.
  2. 2. Access the Macro Editor: Press Alt + F11 to open the WPS Macro Editor interface.
  3. 3. Run Chart Formatting Scripts: Insert or edit your chart formatting module and execute the VBA script directly to apply your desired marker styles.
Fully compatible with Microsoft Excel VBA syntax and chart objectsSupports complex chart formatting and secondary axesLightweight application with fast macro execution speedsSave, edit, and run .xlsm macro-enabled workbooks effortlessly
microsoft office alternative - wps office

Frequently Asked Questions

Why does my VBA code work for standard charts but not combo charts?

Combo charts contain mixed series types (e.g., columns and lines). If a series is initially processed by VBA as a column type, applying the MarkerStyle property will silently fail. You must explicitly set the ChartType of that specific series to xlLineMarkers before applying marker styles.

What is the correct VBA syntax to change marker size?

Once you have correctly targeted the series, you can adjust the size of the markers using the MarkerSize property. For example: ActiveChart.SeriesCollection(1).MarkerSize = 8.

Can I apply custom colors to chart markers using macros?

Yes. You can use properties like MarkerBackgroundColor and MarkerForegroundColor along with standard RGB values (e.g., RGB(255, 0, 0) for red) to fully customize marker colors via VBA.