Auto-Color Chart Bars Version 2
This next variation of the color-bars macro allows you to assign colors to the chart bars based on the background colors of selected cells. For example, assume the screenshot below:
The macro below loops through the department column and assigns a color to the bars based on that department.
Sub ColorBars()
Application.ScreenUpdating = False
Dim Rng As Range
Dim Cnt As Integer
Dim Color As Integer
Cnt = 1
For Each Rng In Range("B3:B10")
Color = Rng.Interior.ColorIndex
Set Pts = ActiveChart.SeriesCollection(1).Points(Cnt)
Pts.Interior.ColorIndex = Color
Cnt = Cnt + 1
Next Rng
End Sub
The final product looks like the chart below.