Brock_Hardchest
New Member
- Joined
- Feb 23, 2018
- Messages
- 27
Hello,
I'm comparing two arrays to each other. If the element in the first array is in the second array then it loads a third array with the number "243". The first array is set to loop through the first 1000 elements right now and the second array has 95,000 elements to check which takes 27 seconds to complete the loop. During actual application the first array will loop 1 million elements and the second array will have 95,000 elements. Any ideas on how to make it faster?
I'm comparing two arrays to each other. If the element in the first array is in the second array then it loads a third array with the number "243". The first array is set to loop through the first 1000 elements right now and the second array has 95,000 elements to check which takes 27 seconds to complete the loop. During actual application the first array will loop 1 million elements and the second array will have 95,000 elements. Any ideas on how to make it faster?
VBA Code:
For i = 1 To 1000
For j = 1 To UBound(x243, 1)
If lookup2(i, 1) = x243(j, 1) Then
TypeArray(i, 1) = 243
Exit For
End If
Next j
Next i
'write array to type column
Range("U2:U" & BottomRow).Value = TypeArray