Chart & Visualization Issues

Fix VBA Marker Colors in an Excel Scatter Chart

Aamir Naveed AkramAamir Naveed Akram Dec 2, 2026 869 views

Question details

The user needs to keep scatter chart marker colors consistent when an Excel VBA macro changes chart formatting.

Fix VBA Marker Colors in an Excel Scatter Chart
Product
Microsoft Excel
Device & OS
not provided
Scenario
A VBA macro creates or modifies an Excel scatter chart and formats its data series.
Observed behavior
Marker colors can change when the macro reapplies series formatting or uses theme colors.
Before you start

Open the workbook in desktop Excel and identify the chart name and series you want to format. Make sure the workbook is saved as a macro-enabled .xlsm file if it contains VBA code.

Solution 1Recommended

Set fixed RGB marker colors after formatting the chart

Use this approach to prevent theme or chart style changes from determining the final marker colors.

1
Open the VBA editor

In desktop Excel, open the Developer tab and select Visual Basic. Open the module containing the macro that creates or modifies the chart.

2
Assign the marker colors

After the chart creation and formatting code, add lines such as: With ActiveSheet.ChartObjects("Chart 1").Chart.SeriesCollection(1) .MarkerStyle = xlMarkerStyleCircle .MarkerBackgroundColor = RGB(255, 0, 0) .MarkerForegroundColor = RGB(255, 0, 0) End With Replace "Chart 1" with your chart name, adjust the series index, and choose your RGB values.

3
Format the remaining series

Repeat the With block for each SeriesCollection index that needs a fixed color. Set both MarkerBackgroundColor and MarkerForegroundColor for each series.

4
Run and check the macro

Run the macro from Developer > Macros, then inspect the scatter chart. Keep the color assignments after any chart style or series formatting commands so those commands do not overwrite them.

Set fixed RGB marker colors after formatting the chart
Avoid repeated style resets: If another part of the macro resets the chart style or series formatting later, move the color assignments after that code or apply them again afterward.
Free Microsoft Office alternative

Create and edit scatter charts with WPS Office

WPS Office is a free, lightweight alternative with a familiar spreadsheet interface. Open Excel files and work with charts in WPS Spreadsheets for an easier transition, though it does not fix Excel VBA formatting behavior.

Create and edit scatter charts in a familiar spreadsheet interfaceCompatible with Microsoft Excel formats such as XLSX and XLSMFree and lightweight for everyday spreadsheet workOpen existing workbooks to support a smooth move from Microsoft Office
microsoft office alternative - wps office

Frequently Asked Questions

Why do my scatter chart marker colors change after a macro runs?

The macro may reset the chart style or series formatting, or the series may use theme colors. Assign fixed RGB values after those formatting commands.

Which VBA properties control the marker fill and outline?

Use Series.MarkerBackgroundColor for the marker fill and Series.MarkerForegroundColor for its foreground or outline. Assign each property a value such as RGB(255, 0, 0).

How do I give each scatter chart series a different color?

In the VBA editor, address each series with Chart.SeriesCollection(index) and set its MarkerBackgroundColor and MarkerForegroundColor to the desired RGB values.

Can I run this VBA fix in Excel for the web?

Excel for the web does not run VBA macros. Open the workbook in desktop Excel, then use Developer > Visual Basic to edit the code and Developer > Macros to run it.