|
Sub 按钮1_Click()
Set d = CreateObject("scripting.dictionary")
Set dd = CreateObject("scripting.dictionary")
Application.ScreenUpdating = False
For Each sh In Sheets
If sh.Name <> "统计" Then
arr = sh.[a1:r18]
For j = 1 To UBound(arr)
For i = 1 To UBound(arr, 2)
d(Cells(j, i).Address(0, 0)) = d(Cells(j, i).Address(0, 0)) & "," & arr(j, i)
Next i
Next j
End If
Next sh
Sheets("统计").Select
r = 0
For Each k In d.keys
r = r + 1
arr = Split(d(k), ",")
Cells(r, 13) = k
Cells(r, 14) = Mid(d(k), 2)
For j = 1 To UBound(arr)
dd(arr(j)) = dd(arr(j)) + 1
Next j
For j = WorksheetFunction.Min(dd.items) To WorksheetFunction.Max(dd.items)
str1 = ""
For Each x In dd.keys
If dd(x) = j Then
str1 = str1 & "," & Format(x, "00")
End If
Next x
If Len(str1) > 0 Then
r = r + 1
Cells(r, 14) = "〖" & j & "次〗:" & Mid(str1, 2)
End If
Next j
Next k
Application.ScreenUpdating = True
End Sub
|
|