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...以此下去

數值較大的變為紅色

該怎麼做? 謝謝
文章關鍵字
可以在設定格式化的條件中
設定找出排在最前的第一個數值,格式化文字為紅色
但是每一列都要分別建立條件
如果資料很多,就建議用VBA了
一個中文,各自表述
VBA...簡單的練習...


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
文章分享
評分
評分
複製連結

今日熱門文章 網友點擊推薦!