A B
1 10 17
2 76 22
3 43 46
4 33 37
5 24 95
6 61 21
. . .
. . .
. . .
請問我要A1比B1,A2比B2,A3比B3...以此下去
數值較大的變為紅色
該怎麼做? 謝謝
Sub Macro1()
Dim i, e
e = [a65536].End(xlUp).Row
For i = 1 To e
If Range("B" & i).Value > Range("A" & i).Value Then
Range("B" & i).Select
Selection.Font.ColorIndex = 3
Range("A" & i).Select
Selection.Font.ColorIndex = 0
Range("B" & i + 1).Select
Selection.Font.ColorIndex = 0
Else
If Range("B" & i).Value < Range("A" & i).Value Then
Range("A" & i).Select
Selection.Font.ColorIndex = 3
Range("B" & i).Select
Selection.Font.ColorIndex = 0
Range("A" & i + 1).Select
Selection.Font.ColorIndex = 0
Else
Range("A" & i & ":" & "B" & i + 1).Select
Selection.Font.ColorIndex = 0
End If
End If
Next i
End Sub
內文搜尋

X