18 Nov 2013

Display the Unique values and delete the duplicate values in an array using Vb Scripting

Display the Unique values and delete the duplicate values in an array using Vb Scripting

Dim arr, res(8), temp, count1 

count1=0

arr=array(0,12,47,58,21,12,0,47,69)

For i=lbound(arr) to ubound(arr)
    
temp=i

    For j=i+1 to ubound(arr)

        If arr(i)<>arr(j) Then

            temp=temp+1

        End If
    Next
    If temp=ubound(arr) Then
        res(count1)=arr(i)
        count1=count1+1

    End If

Next

For i=0 to count1-1
   msgbox res(i)
Next

No comments:

Post a Comment