EXCEL两组数相等红色标示并放到第三列_VBA
Sub b()
For i = 1 To 120 Step 1 '從第1行至第9行,如果行數較多,將9改為行數
For t = 1 To 120 Step 1
If Cells(i, 1) = Cells(t, 3) ?_
Then?Cells(i, 1).Font.Color = RGB(255, 0, 0): Cells(t, 3).Font.Color = RGB(255, 0, 0)
'必須有空格 換行符(注釋的標點需是英文標點,并且不能在換行符一行,并且不能在上面換行符后)
Next t
Next i
End Sub
2011.12.12更新(整合)
?Sub b()
For i = 1 To 15 Step 1
For t = 1 To 15 Step 1
If Cells(i, 1) = Cells(t, 2) Then
Cells(i, 1).Font.Color = RGB(255, 0, 0)
Cells(t, 2).Font.Color = RGB(255, 0, 0)
Cells(i, 3) = Cells(i, 1)
Else
End If
Next t
Next i
End Sub
D/E列相同數值顏色標示VBA
Sub jy()
For i = 1 To 11
? ? If Range("d" & i) = Range("e" & i) Then
? ? ? ? Range("d" & i).Interior.ColorIndex = 3
? ? ? ? Range("e" & i).Interior.ColorIndex = 3
? ? Else
? ? ? ? Range("d" & i).Interior.ColorIndex = xlColorIndexNone
? ? ? ? Range("e" & i).Interior.ColorIndex = xlColorIndexNone
? ? End If
Next i
End Sub
總結
以上是生活随笔為你收集整理的EXCEL两组数相等红色标示并放到第三列_VBA的全部內容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: [转载]MVP(SC),MVP(PV),
- 下一篇: 数据中心扩张和产能计划