Hello first time here...I'll try to keep this short.
Im creating bar charts that use scores that are ranked and assign a color to each bar based on the name in the Color Legend. For some bars i also need to include a pattern to help differentiate similar names. i have been able to have the colors follow the bars without issue but i have been unable to have specific bars have a pattern. I cannot change names or go back and manually edit each time for other reasons. The image shows two bars, Mike and Mike2. i need Mike2 to also have a pattern, any pattern at this point included, that will follow the bar regardless of score/ position.
My "Chart"
....and my VBA:
Sub ColorByCategoryLabel()
ActiveSheet.ChartObjects("Chart 1").Activate
Dim rPatterns As Range
Dim iCategory As Long
Dim vCategories As Variant
Dim rCategory As Range
Set rPatterns = ActiveSheet.Range("A5:A12")
With ActiveChart.SeriesCollection(1)
vCategories = .XValues
For iCategory = 1 To UBound(vCategories)
Set rCategory = rPatterns.Find(What:=vCategories(iCategory))
.Points(iCategory).Format.Fill.ForeColor.RGB = rCategory.Interior.Color
Next
End With
End Sub
Any help would be greatly appreciated.
Thanks!!!!
-CST
Im creating bar charts that use scores that are ranked and assign a color to each bar based on the name in the Color Legend. For some bars i also need to include a pattern to help differentiate similar names. i have been able to have the colors follow the bars without issue but i have been unable to have specific bars have a pattern. I cannot change names or go back and manually edit each time for other reasons. The image shows two bars, Mike and Mike2. i need Mike2 to also have a pattern, any pattern at this point included, that will follow the bar regardless of score/ position.
My "Chart"
....and my VBA:
Sub ColorByCategoryLabel()
ActiveSheet.ChartObjects("Chart 1").Activate
Dim rPatterns As Range
Dim iCategory As Long
Dim vCategories As Variant
Dim rCategory As Range
Set rPatterns = ActiveSheet.Range("A5:A12")
With ActiveChart.SeriesCollection(1)
vCategories = .XValues
For iCategory = 1 To UBound(vCategories)
Set rCategory = rPatterns.Find(What:=vCategories(iCategory))
.Points(iCategory).Format.Fill.ForeColor.RGB = rCategory.Interior.Color
Next
End With
End Sub
Any help would be greatly appreciated.
Thanks!!!!
-CST