去重

Sub 去重()
Application.ScreenUpdating = False
Dim r As Range, arr
With CreateObject("scripting.dictionary")
a = Cells(2000, 9).End(xlUp).Row
    For k = 9 To 10
        For Each r In Range(Cells(4, k), Cells(a, k))
            If Not .Exists(r.Value) And r.Value <> "" Then .Add r.Value, Nothing
        Next
            Cells(4, k + 4).Resize(.Count, 1) = Application.WorksheetFunction.Transpose(.Keys)
            .RemoveAll
    Next
End With
Application.ScreenUpdating = True
End Sub
原文地址:https://www.cnblogs.com/lizicheng/p/9504862.html