duplicate arrays

J-F

Registered User.
Local time
Today, 05:44
Joined
Nov 14, 2001
Messages
41
I thought I'd got this one sussed but it's not working.

I'm trying to find if any 2 arrays are of the same value. I have this....

while x < UBound(PcArray)
While y < UBound(PcArray)
If PcArray(x) = PcArray(y) AND (x <> y) Then
msgbox PcArray(x) & " has been enterred twice!"
Exit Function
End If
y = y + 1
Wend
x = x + 1
Wend
 
Your logic wasn't right. it would have only done the full loop on the first x then every one after that would have only compared the last value.

hth

while x < UBound(PcArray)
While y < UBound(PcArray)
If PcArray(x) = PcArray(y) AND (x <> y) Then
msgbox PcArray(x) & " has been enterred twice!"
Exit Function
End If
y = y + 1
Wend
y=0 '(or 1)However youre working it
x = x + 1
Wend
 
Thanks. I can see the problem now.
 

Users who are viewing this thread

Back
Top Bottom