提问人:shadow777 提问时间:5/22/2018 更新时间:5/22/2018 访问量:88
Excel - 条形图中基于值的彩色条形图
Excel - coloured bars in bar chart based on value
答:
1赞
Olly
5/22/2018
#1
您可以使用 VBA 根据以下值重新格式化条形图:
Sub BarChartConditionalFormat()
Dim ser As Series
Dim v() As Variant
Dim i As Integer
With ActiveSheet.ChartObjects("Chart 1").Chart
For Each ser In .SeriesCollection
v = ser.Values
For i = LBound(v) To UBound(v)
If v(i) >= 1 Then
ser.Points(i).Format.Fill.ForeColor.RGB = RGB(0, 255, 0)
Else
ser.Points(i).Format.Fill.ForeColor.RGB = ser.Format.Fill.ForeColor
End If
Next i
Next ser
End With
End Sub
评论
0赞
shadow777
5/22/2018
这正是我想要的。多谢!:)
下一个:简单的 Web 模板
评论