|
[广告] VBA代码宝 - VBA编程加强工具 · VBA代码随查随用 · 内置多项VBA编程加强工具 ★ 免费下载 ★ ★ 使用手册★
Option Explicit
Sub TEST()
Dim ar, i&, j&, k&, dic As Object, vKey
Application.ScreenUpdating = False
Set dic = CreateObject("Scripting.Dictionary")
For k = 1 To 14
With Cells(8, (k - 1) * 9 + 2).Resize(, 9).Resize(29993)
.Interior.ColorIndex = xlNone
ar = .Value
For i = 1 To UBound(ar)
dic.RemoveAll
For j = 1 To UBound(ar, 2)
If ar(i, j) <> "" Then
dic(ar(i, j)) = dic(ar(i, j)) + 1
End If
Next j
For Each vKey In dic.keys
If dic(vKey) > 1 Then
For j = 1 To UBound(ar, 2)
If ar(i, j) = vKey Then
.Cells(i, j).Interior.Color = vbRed
End If
Next j
Else
For j = 1 To UBound(ar, 2)
If ar(i, j) = vKey Then
.Cells(i, j).Interior.Color = vbBlue
End If
Next j
End If
Next
Next i
End With
Next k
Set dic = Nothing
Application.ScreenUpdating = True
Beep
End Sub
|
评分
-
1
查看全部评分
-
|