|
楼主 |
发表于 2022-11-11 19:48
|
显示全部楼层
代码很简单,不过我呢就写的稍微复杂了点,其实简单一个循环就完成了
- Option Base 1
- Sub Main()
- Dim ch(3) As Chart, TitleText$
- Dim myColor&, i%, j%, k%
- With Sheet1
- Set ch(1) = .ChartObjects(1).Chart
- Set ch(2) = .ChartObjects(2).Chart
- Set ch(3) = .ChartObjects(3).Chart
- .Calculate
- End With
- For i = 1 To 3
- TitleText = ch(i).ChartTitle.Text
- k = Val(TitleText)
- With ch(i).SeriesCollection(1)
- For j = 1 To 100
- If j > k Then
- myColor = RGB(200, 200, 200)
- Else
- myColor = RGB(0, 255 - 200 * j / k, 0)
- End If
- With .Points(j)
- .Format.Fill.ForeColor.RGB = myColor
- End With
- Next
- End With
- Next
- End Sub
复制代码
|
评分
-
2
查看全部评分
-
|