How to format a data series in a single setting?

JenniferMurphy

Well-known Member
Joined
Jul 23, 2011
Messages
2,687
Office Version
  1. 365
Platform
  1. Windows
Unless there is something that I don't understand, always a likelihood, if I want to change the color of a data series in a scatter plot, I have to change 3 settings: the line, the markers, and the marker fill. This seems like an unnecessary inconvenience. Is there a way to change all three with a single setting?

Thanks
 

Excel Facts

Shade all formula cells
To shade all formula cells: Home, Find & Select, Formulas to select all formulas. Then apply a light fill color.
Since I often have each of those things set to a different color, your unnecessary inconvenience is my essential feature. If you always set to one color, why not write a custom function to do that?

VBA Code:
Sub SetSeriesColor(WS As Worksheet, ChartName As String, SeriesNumber As Long, SeriesColor As Long)
    With WS.ChartObjects(ChartName).Chart.SeriesCollection(SeriesNumber)
        .MarkerBackgroundColor = SeriesColor
        .MarkerForegroundColor = SeriesColor
        .Format.Line.BackColor.RGB = SeriesColor
        .Format.Line.ForeColor.RGB = SeriesColor
    End With
End Sub


VBA Code:
Sub Test()
    SetSeriesColor ActiveSheet, "Chart 1", 2, vbBlue
    SetSeriesColor ActiveSheet, "Chart 1", 2, vbYellow
    SetSeriesColor ActiveSheet, "Chart 1", 2, vbRed
End Sub
 
Upvote 0
Since I often have each of those things set to a different color, your unnecessary inconvenience is my essential feature. If you always set to one color, why not write a custom function to do that?

It would be my guess that having them all the same color is very common, if not the most common arrangement. But providing me with a way to set all three with one setting needn't prevent you from setting them all to different colors. They just need to provide a "set all the same" checkbox.

Thanks for the code. If no one comes with a better (simpler) solution. I'll probably use it. It just annoys me that I have to write yet another macro to make up for functions that should be included.

Thanks
 
Upvote 0

Forum statistics

Threads
1,223,896
Messages
6,175,259
Members
452,626
Latest member
huntinghunter

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top