|
本帖最后由 xiangbaoan 于 2020-5-15 10:55 编辑
Option Explicit
Sub test()
Dim ar, br, d As Object, i&, j&, k&, x&, y&
Set d = CreateObject("Scripting.Dictionary")
ar = Sheet1.Range("b3").Resize(4, 10) '2000
br = Sheet2.Range("b3").Resize(16, 18) '500
ReDim cr(1 To UBound(ar), 0 To 10)
For i = 1 To UBound(ar)
For y = 1 To UBound(br)
d.RemoveAll
k = 0
For x = 1 To 18
d(br(y, x)) = ""
Next
For j = 1 To 10
If d.Exists(ar(i, j)) Then k = k + 1
Next
cr(i, 10 - k) = cr(i, 10 - k) + 1
Next
Next
Sheet3.Range("b3").Resize(i - 1, j) = cr
Set d = Nothing
End Sub |
|