Friday, August 5, 2011

Extract Unique List :

if you want to Extract Unique Value From a List , you can use this UDF :

Function UniqueList(rng As Range, Pos As Long) As String Dim List() As String
    Dim cell As Range
    Dim i As Long
    Dim t As Long
    i = 0
ReDim List(rng.Cells.Count) As String
For Each cell In rng
flag = 0
                    For t = LBound(List) To UBound(List)
                       If cell.Value = List(t) Then
                 
                        flag = 1
                        Exit For
                        End If
                        Next
                           
                            If flag = 0 Then
                            List(i) = cell.Value
                            i = i + 1
                            End If
Next
UniqueList = List(Pos)
End Function

No comments: