📜  excel vba formatconditions range - VBA 代码示例

📅  最后修改于: 2022-03-11 14:51:53.632000             🧑  作者: Mango

代码示例1
Dim MyRange As Range
Set MyRange = ThisWorkbook.Worksheets(1).Range("A1:C10")
With MyRange    ' whole row into red when A value <> B value
    .Cells(1, 1).FormatConditions.Add Type:=xlExpression, Formula1:="=$A1<>$B1"
    .FormatConditions(1).Font.Color = vbRed
    .Cells.FormatConditions(1).ModifyAppliesToRange MyRange
End With