如何让两列满足这两个条件,然后将其突出显示为红色?现在要么是列符合条件,那么它会突出显示红色。
If InStr(rcol.Value, "L-Start") > 0 Then
With rcol.EntireColumn.Cells
.FormatConditions.Add Type:=xlCellValue, Operator:=xlLess, Formula1:="=(today() - 120)"
With .FormatConditions(1).Font
.Color = RGB(255, 0, 0)
End With
End With
End If
If InStr(rcol.Value, "L-Type") > 0 Then
With rcol.EntireColumn.Cells
.FormatConditions.Add Type:=xlCellValue, Operator:=xlEqual, Formula1:="=""Q"""
With .FormatConditions(1).Font
.Color = RGB(255, 0, 0)
End With
End With
End If
答案 0 :(得分:0)
如果满足两个条件,此代码将仅将单元格绘制为红色
If InStr(rcol.Value, "L-Start") > 0 And InStr(rcol.Value, "L-Type") > 0 Then
With rcol.EntireColumn.Cells
.FormatConditions.Add Type:=xlCellValue, Operator:=xlLess, Formula1:="=(today() - 120)"
.FormatConditions.Add Type:=xlCellValue, Operator:=xlEqual, Formula1:="=""Q"""
With .FormatConditions(1).Font
.Color = RGB(255, 0, 0)
End With
With .FormatConditions(2).Font
.Color = RGB(255, 0, 0)
End With
End With
End If
我希望这是你需要的。