本帖最后由 xingqiliu666 于 2022-12-9 18:06 编辑
Sub 循环()
Dim tim: tim = Timer
Range("r3:u65536").ClearContents
Dim ar, cr, i%, j%, t%, temp
ar = Range("c3:h" & [c65536].End(xlUp).Row)
temp = Array("ga1:gp3", "gr1:hb3", "hd1:hn3", "hp1:hz3")
ReDim cr(1 To UBound(ar), 1 To 4)
For t = 1 To 4
br = Range(temp(t - 1)).CurrentRegion
For i = 1 To UBound(ar)
For j = 1 To UBound(br, 2)
n = 0
For k = 1 To UBound(br)
For x = 1 To UBound(ar, 2)
If br(k, j) = ar(i, x) Then
n = n + 1
Exit For
End If
Next
Next
If n > 0 Then y = y + 1
Next
cr(i, t) = y
y = 0
Next
Next
Cells(3, 18).Resize(UBound(cr, 1), UBound(cr, 2)) = cr
[a1] = Format(Timer - tim, "0.00") & "秒"
End Sub
|