如果单元格值大于其他列中的另一个单元格,我需要更改单元格颜色。例如 G6 > D6 中的值,此规则需要适用于整个列。
我用 formatConditions 实现了一些代码,但结果不是很正确。
Set rngCell = Cells(6, 7)
Set objCF = rngCell.FormatConditions.Add _
(Type:=xlCellValue, Operator:=xlGreater, Formula1:=rngCell.offset(, -3))
'set formats for new CF
With objCF
.Font.ColorIndex = 26
.Interior.ColorIndex = 19
End With
使用此代码,我得到的结果规则是:单元格值 > 18(18 是 D6 的单元格值)
但我想要的是这样的规则:单元格值 > $D6
任何人都可以帮忙吗?