【发布时间】:2017-07-18 15:47:43
【问题描述】:
我试图在我的条件格式示例中使用 if 语句。我已经能够成功地使用条件格式,但是在弄清楚如何在其中合并 if 语句时遇到问题。 if 语句是...
IF cell I2 is not empty AND cell b2 < 1 mark the cell red.
IF (AND(I2 <> "", B2 < 1), Red?, not red?)
我觉得这里有两块拼图,但不知道如何将它们拼在一起。
条件格式代码:
protoWorksheet.Range("E2:E100").FormatConditions.Add(XlFormatConditionType.xlExpression, Type.Missing, "=E2=""Gap""").Interior.Color = RGB(255, 0, 0)
【问题讨论】:
-
如果你只是在做一个条件格式公式,你不需要
IF()部分。您可以将公式设置为=AND($I2<>"",$B2<1)只有当两个部分都解析为TRUE时才会应用条件格式。 -
@BruceWayne 我使用`protoWorksheet.Range("B2:B100").FormatConditions.Add(XlFormatConditionType.xlExpression, Type.Missing, "=AND( I2"",B2
-
对于 O2空白尝试
I2<>""""(四个引号而不是两个) -
@Brucewayne 该死的双引号总是让我……像魅力一样工作。抛出一个答案!
-
如果这是 VBA,你有 wring 标签 - VBA IsNot VB.NET
标签: excel formula conditional-formatting