EXCEL两组数相等红色标示并放到第三列_VBA
Sub b()
For i = 1 To 120 Step 1 '從第1行至第9行,如果行數(shù)較多,將9改為行數(shù)
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)
'必須有空格 換行符(注釋的標(biāo)點(diǎn)需是英文標(biāo)點(diǎn),并且不能在換行符一行,并且不能在上面換行符后)
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列相同數(shù)值顏色標(biāo)示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
總結(jié)
以上是生活随笔為你收集整理的EXCEL两组数相等红色标示并放到第三列_VBA的全部?jī)?nèi)容,希望文章能夠幫你解決所遇到的問(wèn)題。
- 上一篇: [转载]MVP(SC),MVP(PV),
- 下一篇: InstallShield 2012 S