|
[广告] VBA代码宝 - VBA编程加强工具 · VBA代码随查随用 · 内置多项VBA编程加强工具 ★ 免费下载 ★ ★ 使用手册★
Sub TEST2()
Dim ar, br(), cr, i&, j&, k&, kk&, n&, r&, vKey, dic As Object, strJoin$
Application.ScreenUpdating = False
Set dic = CreateObject("Scripting.Dictionary")
With Range("C2", Cells(Rows.Count, "AUU").End(xlUp))
ar = .Value
.Interior.Color = xlNone
For j = 1 To UBound(ar, 2) Step 3
r = r + 1
ReDim Preserve br(1 To r)
br(r) = .Cells(1, j).Resize(UBound(ar), 2)
strJoin = ""
For i = 1 To UBound(br(r))
For k = 1 To UBound(br(r), 2)
strJoin = strJoin & br(r)(i, k)
Next k
Next i
dic(strJoin) = dic(strJoin) & " " & r
Next j
k = 6
kk = 3
n = 0
For Each vKey In dic.keys
cr = Split(dic(vKey))
If UBound(cr) > 1 Then
If k < 56 Then k = k + 1 Else k = 6
If kk < 56 Then kk = kk + 1 Else n = n + 1: kk = 3 + n
For i = 1 To UBound(cr)
.Cells(1, (cr(i) - 1) * 3 + 1).Resize(UBound(ar) / 2, 2).Interior.ColorIndex = k
.Cells(UBound(ar) / 2 + 1, (cr(i) - 1) * 3 + 1).Resize(UBound(ar) / 2, 2).Interior.ColorIndex = kk
Next
End If
Next
End With
Application.ScreenUpdating = True
Beep
End Sub
|
|