|
Sub 去重复()
Application.ScreenUpdating = False
Dim ar As Variant
Dim d As Object, dc As Object
Set d = CreateObject("scripting.dictionary")
With Sheets("sheet1")
r = .Cells(Rows.Count, 2).End(xlUp).Row
ar = .Range("b3:f" & r)
End With
ReDim arr(1 To UBound(ar), 1 To 2)
For i = 2 To UBound(ar)
If Trim(ar(i, 2)) <> "" And Trim(ar(i, 3)) <> "" Then
zf = Trim(ar(i, 2)) & "|" & Trim(ar(i, 3))
t = d(zf)
If t = "" Then
k = k + 1
d(zf) = k
t = k
arr(k, 1) = ar(i, 2)
arr(k, 2) = ar(i, 3)
End If
End If
Next i
With Sheets("统计")
rs = .Cells(Rows.Count, 1).End(xlUp).Row
.Range("a4:b" & rs) = Empty
.[a4].Resize(k, 2) = arr
End With
MsgBox "ok!"
End Sub
|
|