|
- Sub simoy()
- Dim cr(1 To 55555, 1 To 8), i&, j%, m&, n&, kk As Boolean
- t = Timer
- ar = Sheet2.[a1].CurrentRegion
- br = Sheet1.[a1].CurrentRegion
- For i = 2 To UBound(ar)
- kk = False
- For m = 2 To UBound(br)
- If br(m, 1) = ar(i, 1) Then
- kk = True
- n = n + 1
- For j = 1 To UBound(br, 2)
- cr(n, j) = br(m, j)
- Next
- End If
- Next
- If kk = False Then
- n = n + 1
- cr(n, 1) = ar(i, 1)
- End If
- Next
- With Sheet3
- .Cells.AutoFilter
- .UsedRange.Offset(1).ClearContents
- .[a2].Resize(n, 8) = cr
- .UsedRange.EntireColumn.AutoFit
- If .AutoFilterMode = 0 Then .Rows("1:1").AutoFilter
- End With
- MsgBox "提取完毕,共用时" & Format(Timer - t, "#0.00") & "秒"
- End Sub
复制代码 |
|