View Single Post
  #1   Report Post  
Posted to microsoft.public.excel.programming
RichardSchollar RichardSchollar is offline
external usenet poster
 
Posts: 196
Default Data Validation

Hi Trev

You can use Advanced Filtering to produce a unique items list, or you
could use the following code that produces a collection of unique items
(it uses the value in the cell as the key in the collection.Add method
with an On Error Resume Next which means if that key already exists ie
it's a duplicate, then the code skips over to the next cell).

Sub test()
Dim coll As New Collection, c As Range, i As Long
With Sheets("Info")
On Error Resume Next
For Each c In .Range("A1:A" & .Range("A65536").End(xlUp).Row)
coll.Add c.Value, c.Value
Next c
End With
On Error GoTo 0
For i = 1 To coll.Count
Debug.Print coll(i)
Next
End Sub

Give it whirl! I hope it helps!

Richard


Trever B wrote:
Hi,

Thanks in advance

Need to create a list from a worksheet "Info" Column A

Problem is lots of repeats.

I would like just every diferent entry (No Repeats)

Hope you can help.

Don't no where to start

Thanks

Trev