L
lopsided
Hi,
I am having a bit of trouble with arrays. I have created two list
arrays which are of different sizes and have some of the same numbers
in them. I want to go through one list and compare every element within
it with every element on the second list. I need to find out
(basically) which numbers are in the first array but not the second.
The outline of the code i am using is as follows:
i = 1
j = 1
For i = LBound(array1) To UBound(array1)
Do While array1(i) <> array2(j)
For j = LBound(array2) To UBound(array2)
If j = UBound(array2) Then
~~~Return Some Values~~~
GoTo GetOut
Else: End If
Next j
Loop
GetOut:
Next i
The problem lies in that although there are no bugs in my code the
macro is returning all the data (as if the lists had nothing in
common).
Hope someone can help me!!
Thanks a lot
Tom
I am having a bit of trouble with arrays. I have created two list
arrays which are of different sizes and have some of the same numbers
in them. I want to go through one list and compare every element within
it with every element on the second list. I need to find out
(basically) which numbers are in the first array but not the second.
The outline of the code i am using is as follows:
i = 1
j = 1
For i = LBound(array1) To UBound(array1)
Do While array1(i) <> array2(j)
For j = LBound(array2) To UBound(array2)
If j = UBound(array2) Then
~~~Return Some Values~~~
GoTo GetOut
Else: End If
Next j
Loop
GetOut:
Next i
The problem lies in that although there are no bugs in my code the
macro is returning all the data (as if the lists had nothing in
common).
Hope someone can help me!!
Thanks a lot
Tom