我想自定义图标的标准。我需要5个条件。我用的是IconSetCondition。
条件如下:
我想用这样的方式来使用3个交通灯:
我自愿使用xl5Arrows来获得这5个条件。
Set r = Range(Cells(3, 6), Cells(nbtopics + 2, 6))
With r
With .FormatConditions
.Delete
.AddIconSetCondition
End With
With .FormatConditions(1)
.SetFirstPriority
.ReverseOrder = False
.ShowIconOnly = False
.IconSet = ActiveWorkbook.IconSets(xl5Arrows)
With .IconCriteria(2)
.Type = xlConditionValueNumber
.Value = 0.85
.Operator = xlGreater
End With
With .IconCriteria(3)
.Type = xlConditionValueNumber
.Value = 0.95
.Operator = xlGreater
End With
With .IconCriteria(4)
.Type = xlConditionValueNumber
.Value = 1.05
.Operator = xlGreater
End With
With .IconCriteria(5)
.Type = xlConditionValueNumber
.Value = 1.15
.Operator = xlGreater
End With
End With
End With这段代码可以工作,但是我希望Traffic lights而不是xl5Arrows。
非常感谢你的帮助。如果你需要更多的细节,不要犹豫评论。
发布于 2019-07-24 16:13:05
作为马克·S.,枚举中没有默认的xl5trafficlights
但是,您目前正在设置您的.Type、.Value和.Operator,只需确保同时设置.Icon。这将将IconSetCriteria设置为xlCustomSet。
这是一个xlIcon -“圆圈”,为您建立您的5个交通灯设置如下:
xlIconBlackCircleWithBorder
xlIconGrayCircle
xlIconGreenCircle
xlIconRedCircleWithBorder
xlIconPinkCircle
xlIconYellowCircle
xlIconGreenCheckSymbol
xlIconRedCrossSymbol
xlIconYellowExclamationSymbol
xlIconWhiteCircleAllWhiteQuarters例如:
With .IconCriteria(1)
.Icon = xlIconWhiteCircleAllWhiteQuarters
End With
With .IconCriteria(2)
.Icon = xlIconGreenCircle
.Type = xlConditionValueNumber
.Value = 0.85
.Operator = xlGreater
End With
With .IconCriteria(3)
.Icon = xlIconYellowCircle
.Type = xlConditionValueNumber
.Value = 0.95
.Operator = xlGreater
End With
With .IconCriteria(4)
.Icon = xlIconRedCircleWithBorder
.Type = xlConditionValueNumber
.Value = 1.05
.Operator = xlGreater
End With
With .IconCriteria(5)
.Icon = xlIconBlackCircleWithBorder
.Type = xlConditionValueNumber
.Value = 1.15
.Operator = xlGreater
End With发布于 2019-07-24 13:01:58
然而,对于图标设置,我不相信有一个格式的5个红绿灯,只有xl3TrafficLights1,xl4TrafficLights或xl3TrafficLights2。你可以在这里读到
此外,基于您所说的设置条件的组件应该是.Operator = xlLess或.Operator =xlGreaterEqual。
https://stackoverflow.com/questions/57182771
复制相似问题