mikke3141

05-24-2010, 11:33 AM

Hello All,

I'm building a file with 30000*16 values from multiple sources.

My question is concerning Dictionary exists vs. array function below

Public Function isinarrayex(ByRef FindValue As Variant, ByRef vArr As Variant) As Boolean

Dim vArrEach As Variant

For Each vArrEach In vArr

isinarrayex = (FindValue = vArrEach)

If isinarrayex Then Exit For

Next

End Function

Which one would be faster, the dictionary or the shown code? Also, is there a way to get the function above to be any faster as all the elements that I'm checking existence for are in the first element from array(1,1) to array(30000,1). The function above goes also through array(1,2) to array(30000,16), which certainly makes the function slower.

Thank you for your help.

I'm building a file with 30000*16 values from multiple sources.

My question is concerning Dictionary exists vs. array function below

Public Function isinarrayex(ByRef FindValue As Variant, ByRef vArr As Variant) As Boolean

Dim vArrEach As Variant

For Each vArrEach In vArr

isinarrayex = (FindValue = vArrEach)

If isinarrayex Then Exit For

Next

End Function

Which one would be faster, the dictionary or the shown code? Also, is there a way to get the function above to be any faster as all the elements that I'm checking existence for are in the first element from array(1,1) to array(30000,1). The function above goes also through array(1,2) to array(30000,16), which certainly makes the function slower.

Thank you for your help.