Sub 取不重複值()
Dim myList As New Collection, Cel As Range, itm, i As Integer
On Error Resume Next '遍歷數據區域的單元格
For Each Cel In Sheets("資料所在的工作表").Range("R1:R65536")
If Cel <> "" Then myList.Add Cel.Value, CStr(Cel.Value)'判斷單元格內容是否為空
Next
Sheets("工作表1").Range("a:a").NumberFormatLocal = "@"
On Error GoTo 0
i = 1 '將非重複值寫入工作表
For Each itm In myList
Sheets("準備要輸入的工作表").Cells(i, 1) = Format(itm, "@")
i = i + 1
Next
End Sub