0

我正在比较两个系列,如果第二个系列的值在给定的 XValue 处小于第一个系列,我想将第二个系列的条形设为红色。我尝试关注其他一些论坛答案并解决了这个问题,但现在我被困住了......

Public Sub Bar_Colour()

Dim c As Chart
Dim p As Series
Dim a As Series
Dim iPoint As Long
Dim nPoint As Long

Set c = ActiveChart
Set s = ActiveChart.SeriesCollection(1)
Set a = ActiveChart.SeriesCollection(2)

nPoint = s.Points.Count

For iPoint = 1 To nPoint
    If a.Points(iPoint).Value < s.Points(iPoint).Value Then
        a.Points(iPoint).Interior.Color = RGB(255, 0, 0)
    End If
Next iPoint

End Sub

谢谢!

4

1 回答 1

0
Public Sub Bar_Colour()

Dim c As Chart
Dim p As Series
Dim a As Series
Dim iPoint As Long
Dim nPoint As Long

Set c = ActiveChart
Set s = ActiveChart.SeriesCollection(1)
Set a = ActiveChart.SeriesCollection(2)

nPoint = s.Points.Count

For iPoint = 1 To nPoint
    If a.Values(iPoint) < s.Values(iPoint) Then
        a.Points(iPoint).Interior.Color = RGB(255, 0, 0)
    End If
Next iPoint

End Sub
于 2013-07-17T23:10:38.827 回答