Consider the following approach that uses the .Add method. Here are my assumptions.
Assumption 1: Your list of possibly repeated words resides entirely in Column A in a continuous range (i.e., there are no cells that are skipped or blank) and starts in Cell A1.
Assumption 2: The final list of unique (i.e., non-duplicated) words will be shown in Column B (starting in Cell B1).
Paste in the following code into a module and run the macro:
Sub RemoveDupes()
'Declare variables
Dim nodupes As New Collection
Dim siterange As Range
Dim cell As Range
Dim sites() As String
Dim s As Long
Application.ScreenUpdating = False
Columns("B:B").ClearContents
Set siterange = Range("A1").CurrentRegion
'Build nodupes collection
On Error Resume Next
For Each cell In siterange
nodupes.Add cell.Value, CStr(cell.Value)
Next cell
On Error GoTo 0
'Dimensionalize and populate site vector
ReDim sites(1 To nodupes.Count)
For s = 1 To nodupes.Count
sites(s) = nodupes(s)
Next s
'Transfer array to Column B
For s = 1 To UBound(sites)
Cells(s, 2) = sites(s)
Next s
Application.ScreenUpdating = True
End Sub
Hope this helps.
______________________________________
1. If this reply was helpful, please click the star to the left.
2. If this reply answered your question, mark this thread as [SOLVED].
Bookmarks