' Load nArray with a variant Array of Long values.
nArray = Array(9&, 8&, 7&, 6&, 5&, 4&, 3&, 2&, 1&, 0&)
Except it is not an array of longs, but an array of Variants with long values. If one attempts to pass one element of the array to a function which needs a long, one has to convert the variant to a long, such as: CLng(nArray(i)), otherwise the compiler produces an error because of a type mismatch.
So since it is impossible to populate a long array at one go (as opposed to adding a value to each element one at a time), which would be better:
Would it be better (as in faster) to use a Variant array with Array, or a String array with Split? Or does it make any difference?
In the project I'm working on, I need two arrays. One has around 256 elements, and the other has about half that.
I originally wrote the function as one large Select Case statement with somewhere around 350-400 case statements. But I figured (whether I'm right or wrong, I don't know) that such a large Select Case statement would be much slower than using two arrays. With an array, I can calculate which element I need and then just read that element. The elements in these arrays will have values from 1 to 50 (hence my desire to populate a long array).
Bookmarks