|
Sub 测试()
Dim arr, ar, br, cr, brr
t = Timer
Sheets("测试").Range("t15:z" & Cells(Rows.Count, 26).End(xlUp).Row) = ""
Set d = CreateObject("scripting.dictionary") '原数据
Set dd = CreateObject("scripting.dictionary") '过滤条件
arr = Sheets("测试").Range("a15:f" & Cells(Rows.Count, 6).End(xlUp).Row)
ar = Application.Transpose(Sheets("测试").Range("s15:s" & Cells(Rows.Count, 19).End(xlUp).Row))
ReDim brr(1 To UBound(arr), 1 To UBound(arr, 2) + 1)
For i = 1 To UBound(arr)
d.RemoveAll
m = 0
For j = 1 To UBound(arr, 2)
d(CInt(arr(i, j))) = ""
Next j
For ii = 1 To UBound(ar)
dd.RemoveAll
n = 0
br = Split(Split(ar(ii), "/")(0), ",")
cr = Split(Split(ar(ii), "/")(1), "~")
For k = 0 To UBound(cr)
dd(CInt(cr(k))) = ""
Next k
For iii = 0 To UBound(br)
If d.exists(CInt(br(iii))) Then
n = n + 1
If dd.exists(n) Then
m = m + 1
GoTo 100
End If
Else
If n = 0 And dd.exists(n) Then
m = m + 1
GoTo 100
End If
End If
Next iii
If m <> ii Then GoTo 10
100: Next ii
If m = UBound(ar) Then
s = s + 1
For j = 1 To UBound(arr, 2)
brr(s, 1) = s
brr(s, j + 1) = arr(i, j)
Next j
End If
10: Next i
MsgBox Timer - t
Sheets("测试").[t15].Resize(s, UBound(brr, 2)) = brr
End Sub
|
|