Inverting Chart Colour

DLemcke

New Member
Joined
Jan 6, 2017
Messages
16
I would like to be able to add inverted chart colours with vba using RGB

Here is what I tried to do but is not working correctly

The first part is supposed to set the positive colour and the second part is supposed to set the negative colour

Code:
ActiveSheet.ChartObjects("Chart 6").Activate
    ActiveChart.FullSeriesCollection(1).Points(1).Format.Fill.ForeColor.RGB = RGB(255, 153, 51)


    ActiveChart.FullSeriesCollection(1).Points(1).Select
    With Selection
        .InvertIfNegative = True
        .Format.Fill.ForeColor.RGB = RGB(255, 0, 0)
    End With
 

Excel Facts

Save Often
If you start asking yourself if now is a good time to save your Excel workbook, the answer is Yes
Hello, DLemcke

I'm not sure if you have already solved this probllem.
If not I am going to share the solution.

The negative color is not able to be modified by typing
⇒ .FullSeriesCollection(1).InvertIfNegative = True  
.format.fill.forecolor.rgb =

You can try this, it works for me : )
⇒ .FullSeriesCollection(1).InvertIfNegative = True  
.FullSeriesCollection(1).InvertColor = RGB(xx, xx, xx)



Good luck.
 
Upvote 0

Forum statistics

Threads
1,224,822
Messages
6,181,165
Members
453,021
Latest member
Justyna P

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