Dim rn As Range Set d = CreateObject("scripting.dictionary") For Each rn In [a2:a30] If rn.Value <> "" And Not d.Exists(rn.Value) Then d.Add rn.Value, rn.Value Next Sheet2.[a2:a65536].Clear Sheet2.Range("a2").Resize(d.Count) = Application.Transpose(d.Items)
Sub 字典筛选不重复姓名() Set d = CreateObject("scripting.dictionary") Dim a As Integer, sin1 As Integer sin1 = Sheet1.Range("a65536").End(xlUp).Row For a = 1 To sin1 - 1 stmp = Sheet1.Cells(a + 1, "a") If Not d.exists(stmp) Then d(stmp) = "" End If Next Sheet2.Range("a2").Resize(d.Count, 1) = Application.WorksheetFunction.Transpose(d.keys) End Sub