Hi friends,

i have some values in column A. i want to take only UNIQUE values in some 
array. 
how can i do so? 

i have developed below function and is working exactly i want it to be but i 
think there should be more efficient way of doing so like there may be array 
function for storing only UNIQUE values or anything like that.

Sub UniqueArray()

Dim newarr() As String
Dim blnmatchfnd As Boolean
j = 0
For i = 1 To 46
ReDim Preserve newarr(j)
For k = 0 To UBound(newarr)
If newarr(k) = Range("A" & i).Value Then
blnmatchfnd = True
Exit For
Else
blnmatchfnd = False
End If
Next k

If blnmatchfnd = False Then
ReDim Preserve newarr(j)
newarr(j) = Range("A" & i).Value
Range("B" & j + 1).Value = newarr(j)
j = j + 1
End If

Next i
    End Sub

-- 
----------------------------------------------------------------------------------
Some important links for excel users:
1. Follow us on TWITTER for tips tricks and links : 
http://twitter.com/exceldailytip
2. Join our LinkedIN group @ http://www.linkedin.com/groups?gid=1871310
3. Excel tutorials at http://www.excel-macros.blogspot.com
4. Learn VBA Macros at http://www.quickvba.blogspot.com
5. Excel Tips and Tricks at http://exceldailytip.blogspot.com
 
To post to this group, send email to excel-macros@googlegroups.com

<><><><><><><><><><><><><><><><><><><><><><>
Like our page on facebook , Just follow below link
http://www.facebook.com/discussexcel

Reply via email to