ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Color Chart using offset (https://www.excelbanter.com/excel-programming/352066-color-chart-using-offset.html)

czywrg

Color Chart using offset
 

I have used this code from a previous posting and it works great. Now
need a little help with an enhancement. The code is:

Sub ColorColumns()

Dim vntValues As Variant
Dim intSeries As Integer
Dim intPoint As Integer

With ActiveChart
For intSeries = 1 To .SeriesCollection.Count
With .SeriesCollection(intSeries)
vntValues = .Values
For intPoint = 1 To .Points.Count
If vntValues(intPoint) < 3 Then
' red column
.Points(intPoint).Interior.Color = _
RGB(255, 0, 0)
ElseIf vntValues(intPoint) 8 Then
' green column
.Points(intPoint).Interior.Color = _
RGB(0, 255, 0)
End If
Next
End With
Next
End With

End Sub

My data was all in column A and varied in length. Now I am adding tw
more columns B&C. I would like to color chart column using red an
green as in the above example. The data in A would still be plotted
but the color of the bar would turn color based on a comparison betwee
B and C. B < C = RED, B C =GREEN. My guess would be to use Offset
but not sure were to start.

Thank

--
czywr
-----------------------------------------------------------------------
czywrg's Profile: http://www.excelforum.com/member.php...fo&userid=3105
View this thread: http://www.excelforum.com/showthread.php?threadid=50723



All times are GMT +1. The time now is 12:20 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com