用 宏命令
Sub tc()
Dim i
For i = 1 To ActiveSheet.UsedRange.Rows.Count
If Cells(i, 1) = Cells(i, 2) And Cells(i, 2) <> "" Then
Cells(i, 2).Select
With Selection.Interior
.Pattern = xlSolid
.PatternColorIndex = xlAutomatic
.Color = 5287936
.TintAndShade = 0
.PatternTintAndShade = 0
End With
End If
If Cells(i, 1) < Cells(i, 2) Then
Cells(i, 2).Select
With Selection.Interior
.Pattern = xlSolid
.PatternColorIndex = xlAutomatic
.Color = 255
.TintAndShade = 0
.PatternTintAndShade = 0
End With
End If
If Cells(i, 1) > Cells(i, 2) Then
Cells(i, 2).Select
With Selection.Interior
.Pattern = xlSolid
.PatternColorIndex = xlAutomatic
.Color = 65535
.TintAndShade = 0
.PatternTintAndShade = 0
End With
End If
Next
End Sub