LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default comparing elements from 2 arrays using VBA code

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



------------------------------------------------
~~ Message posted from http://www.ExcelTip.com/
~~ View and post usenet messages directly from http://www.ExcelForum.com/

 
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
comparing ranges/arrays asaylor Excel Worksheet Functions 7 June 13th 06 11:53 PM
Elements and Arrays in Excel Lighthouseman Excel Worksheet Functions 6 February 1st 06 10:06 AM
Comparing 2 arrays [email protected] Excel Worksheet Functions 3 January 2nd 06 02:31 AM
Comparing Arrays TangentMemory Excel Discussion (Misc queries) 2 May 13th 05 05:06 PM
Comparing Arrays KL Excel Worksheet Functions 9 December 3rd 04 08:58 PM


All times are GMT +1. The time now is 11:27 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"