Skip to content
本页内容

FormatConditions (属性)

返回一个 FormatConditions 集合,该集合表示指定区域的所有条件格式。只读。

示例

python
#本示例更改单元格区域 E1:E10 的现有条件格式
def test():
    Range("E1:E10").FormatConditions.Item(1).Modify(xlCellValue, xlLess, "=$A$1")
python
#本示例为 A1:C3 单元格区域添加条件格式,并显示 B2 单元格的条件格式数量,然后将 A1:C3 单元格区域条件格式删除,再显示 B2 单元格的条件格式数量
def test():
    Range("A1:C3").FormatConditions.Add(xlUniqueValues, xlGreater, 6)
    print(Range("B2").FormatConditions.Count)
    Range("A1:C3").FormatConditions.Delete()
    print(Range("B2").FormatConditions.Count)