使用图标集的条件格式

Conditional formatting with Icon sets

我无法找出这段代码的问题:

     With .Range("K8:K" & lRow)
        Set IconCondn = .FormatConditions.AddIconSetCondition

        With IconCondn.FormatConditions(1)
            .ReverseOrder = True
            .ShowIconOnly = False
            .IconSet = ActiveWorkbook.IconSets(xl3Symbols)
        End With
        With IconCondn.FormatConditions(1).IconCriteria(2)
            .Type = xlConditionValueNumber
            .Value = loLi
            .Operator = 7
        End With
        With IconCondn.FormatConditions(1).IconCriteria(3)
            .Type = xlConditionValueNumber
            .Value = upLi
            .Operator = 7
        End With
     End With  

第三行给我一个错误 With IconCondn.FormatConditions(1)

With .Range("K8:K" & lRow)
        Set IconCondn = .FormatConditions.AddIconSetCondition

        With IconCondn.IconCriteria(1)
            .ReverseOrder = True
            .ShowIconOnly = False
            .IconSet = ActiveWorkbook.IconSets(xl3Symbols)
        End With
        With IconCondn.IconCriteria(2)
            .Type = xlConditionValueNumber
            .Value = loLi
            .Operator = 7
        End With
        With IconCondn.IconCriteria(3)
            .Type = xlConditionValueNumber
            .Value = upLi
            .Operator = 7
        End With
     End With  

我认为添加 .FormatConditions(1) 是问题所在,那部分不是必需的。有关详细信息,请参阅 this page