|
- Sub test()
- Dim r%, i%
- Dim arr, brr
- Dim d As Object
- Set d = CreateObject("scripting.dictionary")
- With Worksheets("sheet1")
- r = .Cells(.Rows.Count, 1).End(xlUp).Row
- arr = .Range("a1:g" & r)
- ReDim brr(1 To UBound(arr), 1 To 3)
- For i = 1 To UBound(arr)
- d(CStr(arr(i, 6))) = ""
- Next
- m = 0
- For i = 1 To UBound(arr)
- If Not d.exists(CStr(arr(i, 7))) Then
- m = m + 1
- For j = 1 To 3
- brr(m, j) = arr(i, j)
- Next
- End If
- Next
- End With
- With Worksheets("sheet2")
- .Cells.Clear
- If m > 0 Then
- .Range("a1").Resize(m, UBound(brr, 2)) = brr
- End If
- End With
- End Sub
复制代码 |
|