Seeking method to change bar chart data point color based on value

auto.pilot

Well-known Member
Joined
Sep 27, 2007
Messages
734
Office Version
  1. 365
Platform
  1. Windows
Using XL 2010, I am able to format a bar chart data series with two different colors if some of the values are negative. Checking the 'Invert if negative' box allows me to choose colors for positive and negative values. Ideally, I'd like to create bar charts that are two colors with a qualifier other than positive/negative. i.e.: Green bar if data point is equal to or greater than 10 and red if data point is below 10. Is there any way to do this?

Thanks

Jim
 

Excel Facts

What is the shortcut key for Format Selection?
Ctrl+1 (the number one) will open the Format dialog for whatever is selected.
Hello Jim


I suppose you already discovered how to do it:

VBA Code:
Sub Jim()
Dim arr, i%, p As Point
arr = ActiveChart.FullSeriesCollection(1).Values
For i = LBound(arr) To UBound(arr)
    Set p = ActiveChart.FullSeriesCollection(1).Points(i)
    Select Case arr(i) > 10
        Case True
            p.Format.Fill.ForeColor.RGB = RGB(10, 250, 10)
        Case False
            p.Format.Fill.ForeColor.RGB = RGB(250, 10, 10)
    End Select
Next
End Sub
 
Upvote 0

Forum statistics

Threads
1,212,931
Messages
6,110,745
Members
448,295
Latest member
Uzair Tahir Khan

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