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