Data Point values from chart
this worked fine with a column chart with multiple series:
Sub Tester1()
Dim ser As Series
Dim pt As Point
Dim SeriesNum As Long
Dim i As Long, j As Long
Dim vX As Variant, vY As Variant
SeriesNum = ActiveChart.SeriesCollection.Count
For i = 1 To SeriesNum
Set ser = ActiveChart.SeriesCollection(i)
vX = ser.XValues
vY = ser.Values
j = 0
For Each pt In ser.Points
j = j + 1
If vY(j) < 0 Then
With pt.Interior
.ColorIndex = 3
.Pattern = xlSolid
End With
Else
With pt.Interior
.ColorIndex = 4
.Pattern = xlSolid
End With
End If
Next pt
Next i
End Sub
if your chart is a line chart or other type chart, you would have to use the
properties appropriate to the markers on that chart.
--
Regards,
Tom Ogilvy
"RominallL" wrote:
Okay, don't know if it's do-able but I'd like to have all my series with a
negative value be red and all positive be green.
I tried something like this
For i = 1 to SeriesNum
SerVal = ActiveChart.Series(i).value
If SerVal <0 then
With Selection.Interior
.ColorIndex = 3
.Pattern = xlSolid
End With
Else
With Selection.Interior
.ColorIndex = 3
.Pattern = xlSolid
End With
End if
Next i
It doesn't work. Am I going about this the wrong way?
|