|
Option Explicit
Sub TEST6()
Dim ar, br, cr, i&, j&, k&, n&, dic As Object, vKey
Application.ScreenUpdating = False
Set dic = CreateObject("Scripting.Dictionary")
With Range("B4", Cells(Rows.Count, "BC").End(xlUp))
ar = .Value
.Interior.Color = xlNone
n = 2
For j = 1 To UBound(ar, 2)
dic.RemoveAll
For i = 3 To UBound(ar) Step 2
If Len(ar(i, j)) Then
dic(ar(i, j)) = dic(ar(i, j)) & " " & i
End If
Next i
For Each vKey In dic.keys
cr = Split(dic(vKey))
If UBound(cr) > 1 Then
n = n + 1
If n = 57 Then n = 3
For k = 1 To UBound(cr)
.Cells(cr(k), j).Interior.ColorIndex = n
Next k
End If
Next
Next j
End With
Set dic = Nothing
Application.ScreenUpdating = True
Beep
End Sub
|
|