|
不知道是不是这个样子.
- Sub Match_1()
- Dim t
- Dim Arr, a
- Dim Brr, b
- Dim Crr, c
- t = Timer
- With Sheet1
- Arr = .Cells(1, 2).CurrentRegion
- Brr = .Cells(1, 6).CurrentRegion
- ReDim Crr(1 To UBound(Arr) * UBound(Brr), 1 To 5)
- a = 1: b = 1: c = 0
- Do While a < UBound(Arr)
- b = 1
- Do While b < UBound(Brr)
- If Arr(a, 3) = Brr(b, 1) Then
- c = c + 1
- Crr(c, 1) = Arr(a, 1): Crr(c, 2) = Arr(a, 2): Crr(c, 3) = Arr(a, 3)
- Crr(c, 4) = Brr(b, 2): Crr(c, 5) = Brr(b, 3)
- End If
- b = b + 1
- Loop
- a = a + 1
- Loop
- .Columns("J:N").ClearContents
- .Cells(1, 10).Resize(c, 5) = Crr
- End With
- MsgBox (Timer - t)
- End Sub
复制代码
|
|