怎么利用vb里的循环算法实现对数组中重复数据查找的判别?

怎么利用vb里的循环算法实现对数组中重复数据查找的判别?怎么判断重复的数据的哪一个是待查数据?

http://www.360doc.com/content/13/0905/16/4545623_312422078.shtml

    Dim a()         As Long
    Dim i           As Long
    Dim j           As Long
    ...
    For i = 0 To UBound(a) - 1
        For j = i + 1 To UBound(a)
            If a(i) = a(j) Then
                MsgBox "a(" & i & ") 和 a(" & j & ") 重复。"
                Exit Sub
            End If
        Next
    Next