Excel 如何自定义条件的图标
我想自定义图标标准。我需要5个条件。我使用了IconSetCondition 条件是:Excel 如何自定义条件的图标,excel,vba,excel-formula,Excel,Vba,Excel Formula,我想自定义图标标准。我需要5个条件。我使用了IconSetCondition 条件是: 值0.85 5。其他值与条件一样,第一个条件是其他值,我不知道ReverseOrder是语法xlGreatEqual还是xlGreaterEqual?“我想做些调整谢谢,”亚瑟说。我会保持原样。谢谢你的回答,我明天会试试。 With .IconCriteria(1) .Icon = xlIconWhiteCircleAllWhiteQuarters End With W
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
此代码有效,但是我希望使用交通灯
而不是xl5箭头
非常感谢你的帮助。如果您需要更多详细信息,请随时发表评论。但是对于IConset,我认为没有一种格式可用于5个红绿灯,只有XL3个红绿灯1、XL4个红绿灯或XL3个红绿灯2 此外,根据您所说的内容设置标准的组件应该是
.Operator=xlLess
或.Operator=xlGreaterEqual
xl5trafficlights
但是,您当前正在设置IconCriteria的.Type
、.Value
和.Operator
——请确保同时设置.Icon
。这将把IconSetCriteria
设置为xlCustomSet
这是一个“圆形”交通灯组,供您构建5个交通灯组,如下所示:
xlIconBlackCircleWithBorder
xlIconGrayCircle
xlIconGreenCircle
xlIconRedCircleWithBorder
xlIconPinkCircle
xlIconYellowCircle
xlIconGreenCheckSymbol
xlIconRedCrossSymbol
xlIconYellowExclamationSymbol
xlIconWhiteCircleAllWhiteQuarters
e、 g
嗨,亚瑟,我要做的就是使用宏记录器,做我需要做的,然后使它适合我的需要。我想你需要改变这一点:
.IconSet=ActiveWorkbook.IconSet(xl5Arrows)
一些xl5TrafficLights
或者其他什么,你可以通过宏记录自己找到它。不幸的是没有。确实,只要选中,你只能有4个(xl4TrafficLights
)谢谢你的回答。不幸的是,vba无法识别xl5交通灯
。这就是为什么我使用xl5箭头
来设置5个条件。使用xl3交通灯
时,您必须使用xlGreatEqual
或xlGreater
。所以是的,我同意它应该是1。值>1.15 2。值>1.06 3。值>0.95 4。值>0.85 5。其他值与条件一样,第一个条件是其他值,我不知道ReverseOrder
是语法xlGreatEqual
还是xlGreaterEqual
?“我想做些调整谢谢,”亚瑟说。我会保持原样。谢谢你的回答,我明天会试试。
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