Range![]() ![]() ![]() ![]() ![]() ![]() ![]() |
代表单个区域的所有条件格式的集合。FormatConditions 集合最多可包含三个条件格式。每一条件格式由一个 FormatCondition 对象表示。
可用 FormatConditions 属性返回一个 FormatConditions 对象。可用 Add 方法新建一个条件格式,可用 Modify 方法对现有条件格式进行更改。
下例为 E1:E10 单元格添加条件格式。
With Worksheets(1).Range("e1:e10").FormatConditions _
.Add(xlCellValue, xlGreater, "=$a$1")
With .Borders
.LineStyle = xlContinuous
.Weight = xlThin
.ColorIndex = 6
End With
With .Font
.Bold = True
.ColorIndex = 3
End With
End With
如果试图为单个区域创建三个以上的条件格式,则 Add 方法失效。如果一个区域有三个格式,则使用 Modify 方法可对其中某个格式进行更改。也可以先使用 Delete 方法删除一个格式,然后使用 Add 方法新建一个格式。
有关条件格式的详细信息,请参阅 FormatCondition 对象。