edcharleslynn
Programmer
Hello, i have a problem which seems like it should be basic but i cant work it out.
I have two arrays, and need to check which elements in the first array do not exist in the second. I simply loop through the one array, and have a second loop checking it against the elements in the second array. If it does not find a match, the flag is left set at 0, and so the element should display using MSGBOX. This works however only for the last none match it finds, not all. Can anyone please point out why this might be happening.
My code is as as follows:
Thanks very much
Ed Lynn
I have two arrays, and need to check which elements in the first array do not exist in the second. I simply loop through the one array, and have a second loop checking it against the elements in the second array. If it does not find a match, the flag is left set at 0, and so the element should display using MSGBOX. This works however only for the last none match it finds, not all. Can anyone please point out why this might be happening.
My code is as as follows:
Code:
Dim arrayElement1
Dim arrayElement2
If sourcesize <> thesesize Then
For Each arrayElement1 In thesecodes
flag = 0
For Each arrayElement2 In sourcecodes
If arrayElement1 = arrayElement2 Then
flag = 1
Exit For
End If
Next
If flag <> 1 Then
msgbox arrayElement1
End If
Next
End If
Thanks very much
Ed Lynn