View Single Post
  #5   Report Post  
Posted to microsoft.public.excel.programming
Rick Rothstein \(MVP - VB\)[_1550_] Rick Rothstein \(MVP - VB\)[_1550_] is offline
external usenet poster
 
Posts: 1
Default Eliminating repeats from a list

I believe this macro will do what you want...

Sub MoveUniqueNames()
Dim X As Long
Dim Z As Long
Dim UniqueNames As String
UniqueNames = "*"
Z = 1
With Worksheets("Sheet1")
For X = 1 To .Cells(.Rows.Count, "A").End(xlUp).Row
If InStr(UniqueNames, "*" & .Cells(X, "A").Value & "*") = 0 Then
UniqueNames = UniqueNames & .Cells(X, "A").Value & "*"
Worksheets("Sheet2").Cells(Z, "A").Value = .Cells(X, "A").Value
Z = Z + 1
End If
Next
End With
End Sub

It assumes the worksheet with your original (repeated) name list is Sheet1
(in Column A starting at Row 1) and the worksheet you want to put the unique
name list on is Sheet2 (into Column A starting at Row 1).

Rick


"sycsummit" wrote in message
...
I am using Excel 2003. I am working with a list of names of various
people,
in one column. I need to have this list reproduced on a blank worksheet
with
the repeated names removed.

for instance, the list I'm working with would be something like:
Pat
Pat
Dan
Marie
Marie
Sharron
Sharron
Sharron
Sharron
Daniel
Mark
Mark
Mark
Mark

...and I would need this list to be reproduced on another tab as:
Pat
Dan
Marie
Sharron
Daniel
Mark

Is there a way I can do this?