【发布时间】:2014-02-12 09:15:03
【问题描述】:
我想知道如何以条件格式访问标题为“适用于”的列并输入我自己的条件。 为了更好地参考,我附上了截图。
我在条件格式中添加语法的代码是,
With Selection
.FormatConditions.Delete
.FormatConditions.Add Type:=xlExpression, Formula1:="=" & c.Address & "=TRUE"
.
.
.
End With
我认为应该在其中添加代码,但我找不到正确的语法。
更新:
我将代码更新为如下所示,
With Range(Cells(c.Row, "B"), Cells(c.Row, "N"))
.FormatConditions.Delete
.FormatConditions.Add Type:=xlExpression, Formula1:="=" & c.Address
.FormatConditions(1).Interior.ColorIndex = 15 'change for other color when ticked
End With
这实际上会使特定范围的行与我放置复选框的位置相关,并改变它们的背景颜色。 复选框位置由 c.Address 表示,其中“c”包含我选择放置复选框的单元格的位置。
【问题讨论】:
-
谢谢,你的提示对我帮助很大
标签: vba excel conditional-formatting