Want to protect your cyber security and still get fast solutions? Ask a secure question today.Go Premium

x
Solved

# Compare two arrays

Posted on 2006-07-06
Medium Priority
199 Views
I have two arrays filled with inventory part numbers and pricing information.

Dim existing400(2000, 4)  ~600 items
Dim New400(2000, 3)      ~1200 items

existing400(1,1) 'part number
existing400(1,2) 'Item description
existing400(1,3) 'unit price
existing400(1,4) 'unit price from "New400" array

new400(1,1) 'part number
new400(1,2) 'Item description
new400(1,3) 'unit price

What I am looking to accomplish is to fill the first array(existing400(1,4)) with the current pricing from the second array(new400).

I need ideas on how to set this up.
Thanks,
Bob

0
Question by:RobertStamm
• 2
• 2

LVL 13

Accepted Solution

rettiseert earned 1000 total points
ID: 17051040
Try this:

Dim I As Long, J As Long

For I = LBound(existing400) To UBound(existing400)
For J = LBound(New400) To UBound(New400)
If existing400(I, 1) = New400(J, 1) Then
existing400(1, 4) = New400(1, 3)
End If
Next
Next
0

Author Comment

ID: 17051292
rettiseert,
Found a opps but I was able to fix it.

existing400(1, 4) = New400(1, 3)
Should have been.
existing400(I, 4) = New400(J, 3)

Works great.
Thank you.
Bob
0

LVL 13

Expert Comment

ID: 17051485
yes, a little mistake : )

also, you would like to add a
exit for
after the existing400(I, 4) = New400(J, 3) line
0

Author Comment

ID: 17051548
thanks
Bob
0

## Featured Post

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

I’ve seen a number of people looking for examples of how to access web services from VB6.  I’ve been using a test harness I built in VB6 (using many resources I found online) that I use for small projects to work out how to communicate with web serv…
When trying to find the cause of a problem in VBA or VB6 it's often valuable to know what procedures were executed prior to the error. You can use the Call Stack for that but it is often inadequate because it may show procedures you aren't intereste…
As developers, we are not limited to the functions provided by the VBA language. In addition, we can call the functions that are part of the Windows operating system. These functions are part of the Windows API (Application Programming Interface). U…
Get people started with the process of using Access VBA to control Excel using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Excel. Using automation, an Access application can laun…
###### Suggested Courses
Course of the Month11 days, 6 hours left to enroll