smollah
asked on
arrays
I'm creating an array. I'm reading in 30 numbers, each of which is between 20 and 100. As I input each number, I only want it to print if it is not a duplicate. Would I use a one-dimensional array?
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
Thanks for the quick reply!
Function InArray(arr() as Long, X As Long) As Boolean
Dim I As Integer
Dim Done As Boolean
InArray = False 'Assume not found
Done = True
I = LBound(arr)
Do While Not Done
If X = arr(I) Then
Done = True
InArray = True
ElseIf I = UBound(Arr) Then
Done = True
Else
I = I + 1
End If
Loop
End Function
Anthony