![]() |
Unique numbers in array
Hi I have an array that contains about 200 numbers and I need to check so the array onley contains unique numbers. If it contains double I want to remove them. How do I do that in an easy way? Thanks in advance *** Sent via Developersdex http://www.developersdex.com *** |
Unique numbers in array
Hi,
How do I do that in an easy way? Can we see the code that creates this array? Mike "Kalle" wrote: Hi I have an array that contains about 200 numbers and I need to check so the array onley contains unique numbers. If it contains double I want to remove them. How do I do that in an easy way? Thanks in advance *** Sent via Developersdex http://www.developersdex.com *** |
Unique numbers in array
It come from a datebase question arr = split(rs.fields(0), ",") *** Sent via Developersdex http://www.developersdex.com *** |
Unique numbers in array
Hi
One quick and dirty way: Sub test() MsgBox Uniques("1,2,3,3,3,4,5,4,3,56,12,56", ",") End Sub Function Uniques(strData As String, _ strDelimiter As String) As String Dim C As Collection Dim AR() As String Dim i As Long AR = Split(strData, strDelimiter) Uniques = "" Set C = New Collection On Error Resume Next For i = LBound(AR) To UBound(AR) C.Add AR(i), AR(i) Next For i = 1 To C.Count Uniques = Uniques & C(i) & "," Next Uniques = Left$(Uniques, Len(Uniques) - 1) Set C = Nothing End Function HTH. Best wishes Harald "Kalle" wrote in message ... It come from a datebase question arr = split(rs.fields(0), ",") *** Sent via Developersdex http://www.developersdex.com *** |
All times are GMT +1. The time now is 05:16 PM. |
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com