所以目前我的代码中有这些行,
.Range("C2").Formula = "=IF(B2 = """"," & """REQUIRED""" & "," & """""" & ") "
.Range("C3").Formula = "=IF(B3 = """"," & """REQUIRED""" & "," & """""" & ") "
我的目标是为其添加条件格式,因此,如果它等于范围 =$C$2:$C$3 中的必需,则将背景变为红色,到目前为止,我在网上看到了一些代码,但它们似乎都不适用。我出于我的目的修改了一些现有代码,因为我在 xlExpression“变量未定义”上出现错误。谁能帮我?
.Range("C2:C3").Selection.FormatConditions.Delete
.Range("C2:C3").Selection.FormatConditions.Add TYPE:=xlExpression, Formula1:="=(=$C$2:$C$23 = 'REQUIRED')"