|
Sub jr()
Application.ScreenUpdating = False
Dim i, r, j, Arr1, Arr2, Arr3, d(1 To 500), dic(1 To 500), M, N, p, q, x, Z, d1, d2, Tim
Tim = Timer
Arr1 = Sheets("数据").Range("a1:i" & Sheets("数据").Cells(Rows.Count, 1).End(xlUp).Row)
Arr2 = Sheets("对比").Range("a1:ai" & Sheets("对比").Cells(Rows.Count, 1).End(xlUp).Row)
Arr3 = Sheets("结果").Range("a1:v" & UBound(Arr1))
Set d1 = CreateObject("scripting.dictionary")
Set d2 = CreateObject("scripting.dictionary")
For Z = 1 To UBound(Arr3, 2)
d1(Arr3(3, Z)) = Z
Next
For i = 1 To 500
Set d(i) = CreateObject("scripting.dictionary")
Set dic(i) = CreateObject("scripting.dictionary")
Next
For i = 3 To UBound(Arr2)
For r = 2 To 19
d(i - 2)(Arr2(i, r)) = ""
Next
For j = 20 To 35
dic(i - 2)(Arr2(i, j)) = ""
Next
Next
For i = 4 To UBound(Arr1)
For M = 1 To 500
For r = 2 To 7
If d(M).exists(Arr1(i, r)) Then
p = p + 1
End If
Next
For x = 8 To 9
If dic(M).exists(Arr1(i, x)) Then
q = q + 1
End If
Next
d2(p & "-" & q) = d2(p & "-" & q) + 1
p = 0: q = 0
Next
For N = 0 To d2.Count - 1
Arr3(i, d1(d2.keys()(N))) = d2.items()(N)
Next
d2.RemoveAll
Next
Sheets("结果").[a1].Resize(UBound(Arr3), UBound(Arr3, 2)) = Arr3
Application.ScreenUpdating = True
MsgBox Format(Timer - Tim, "0.0000")
End Sub
|
评分
-
1
查看全部评分
-
|