LionRunner
New Member
- Joined
- Nov 13, 2014
- Messages
- 19
Hello, I'm creating Winner-Loser charts in VBA using a bar chart with the invert function. Positive bars are to be green, and negative bars red. Below is my portion of the code that is successful in inverting the negative bars to be the left side of the vertical axis while positive bars remain on the rights side. Also, it is successfully changing the positive bars from the default blue color to green; but it does not change the negative bars on the left side of the axis from transparent to red.
Does anyone know how to do that?
ActiveChart.SeriesCollection(1).Select
Selection.InvertIfNegative = True
With Selection.Format.Fill
.Visible = msoTrue
.ForeColor.RGB = RGB(0, 176, 80)
.Transparency = 0
.Solid
End With
I even tried to record myself doing it manually but the macro function did not register any new code. I can not figure out how to distinguish the negative bars from the positive bars to use the ForeColor function to change the color.
If anyone needs to test code to answer, the code for red is .ForeColor.RGB = RGB(255, 0, 0)
Thanks!
Does anyone know how to do that?
ActiveChart.SeriesCollection(1).Select
Selection.InvertIfNegative = True
With Selection.Format.Fill
.Visible = msoTrue
.ForeColor.RGB = RGB(0, 176, 80)
.Transparency = 0
.Solid
End With
I even tried to record myself doing it manually but the macro function did not register any new code. I can not figure out how to distinguish the negative bars from the positive bars to use the ForeColor function to change the color.
If anyone needs to test code to answer, the code for red is .ForeColor.RGB = RGB(255, 0, 0)
Thanks!