提示dim rng as rangefor each rng in range("A1:A100") if rng.value=1 then rng.interior.colorindex=(一个数值,好象是5?记不清了,录个宏吧。也可以用。.color=vbyellow什么的吧,自己琢磨) if rng.value=0 then rng.interior.colorindex=next
Sub gb()
Dim i
For i = 1 To 100
If Sheet1.Cells(i, 1) = 1 Then
Sheet1.Cells(i, 1).Interior.ColorIndex = 6
ElseIf Sheet1.Cells(i, 1) = 0 Then
Sheet1.Cells(i, 1).Interior.ColorIndex = 5
End If
Next
End Sub
Sub 填色()
Dim rng As Range
For Each rng In Range("A1:A100")
If rng.Value = 1 Then rng.Interior.ColorIndex = 6
If rng.Value = 0 And rng.Value <> "" Then rng.Interior.ColorIndex = 5
Next
End Sub
条件格式就好了啊