我创建了一个条件格式来根据一个单元格的值比较来更改颜色,但我不知道如何将整个列的格式应用到其他列列? (我必须使用循环来设置格式的所有单元格?)如何使用Excel宏将条件格式应用于多列
'add conditionalFormating for one cell.
Set rngCell = Cells(6, 7)
Set objCF = rngCell.FormatConditions.Add _
(Type:=xlExpression, _
Formula1:="=" & rngCell.Address & " > " & rngCell.offset(, -3).Address)
'set formats for new CF
With objCF
.Font.ColorIndex = 26
.Interior.ColorIndex = 19
End With
在此先感谢
尝试录制宏;) – 2012-04-24 07:11:14
我试过了,但它不起作用。它只能记录下面的脚本:
子Macro2() ' ' Macro2宏 ' ' 范围( “B1”)选择 结束小组 – 2012-04-24 10:42:26
只是好奇。你使用哪种Excel版本? – 2012-04-24 10:43:58