Filtering Arrays

dimanche 12 avril 2015

I'm finding the VBA Filter command just right for extracting certain things from an array.



But I prefer arrays to be 1-based and Filter usually makes them 0-based. (But not always and I'm not sure why)



I wrote a routine that looped through, moving everything up by one, so element one would be empty.

But then I thought of another way...




Code:



tArray = Join(myArray, chr$(250))

myArray = Split(Chr$(0) & tArray, Chr$(0))



(I used chr$(0) as it's an unprintable character)

What would experts here say was the 'best' method, if either ?

Filtering Arrays

0 commentaires:

Enregistrer un commentaire

Labels