Color Chart using offset

C

czywrg

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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top