Forum Discussion
Excel changes multiple series colors at once
WesJD This is funny. I'm trying to achieve the exact opposite of what you're describing here. I have a dataset of 100 iterations and I wish to have them all in one color. Why? Because these are all generated simulations that are based on a single original dataset. I want to make a chart where only the original dataset has a unique color from the other 100 iterations and I don't feel like going through the color of every single one of those 100 series just to change it, then find out that the color is wrong, so I end up changing it again.
TL;DR I'm trying to create your bug on purpose
AhmedMahmoud23 This could be done with VBA. I have some dummy data, an original series plus four iterations (but it can be as many as you want, up to Excel's limit). The original chart is at top right. In "Chart Before" I have formatted the original series with a black line and the first iteration with a gray line. "Chart After" is the result of a simple VBA procedure, below the screenshot.
Sub FormatSeriesTheSame()
If ActiveChart Is Nothing Then
MsgBox "Select a chart and try again!", vbExclamation
GoTo ExitSub
End If
With ActiveChart
Dim iColor As Long
iColor = .SeriesCollection(2).Format.Line.ForeColor.RGB
Dim iSeries As Long
For iSeries = 3 To .SeriesCollection.Count
.SeriesCollection(iSeries).Format.Line.ForeColor.RGB = iColor
Next
End With
ExitSub:
End Sub
- AhmedMahmoud23May 05, 2021Copper ContributorThanks you for the help. It worked perfectly 🙂