Sub 红色()
If [a1] = "yes" Then [b1].Interior.ColorIndex = 3
End Sub
如果A列单元格中的字符为yes,那么B列相应的单元格为红色——代码如下:
Sub 红色()
For i = 1 To [a65536].End(3).Row
If Cells(i, 1) = "yes" Then Cells(i, 2).Interior.ColorIndex = 3
End Sub
追问请问 [A1]这个单元格,如果我要换成变量 i 该怎么写,,,比如说是从A1到A20
追答下面的代码就行。