Will you know how many items need to go into the array at runtime? If so, then you can declare the array at a fixed size based on that. If not, then you will need to ReDim it for each thing you have to add to it. When you redim, you need to preserve the contents. Usually you do something like this:
Dim aryMyArray()
For Each Thing
ReDim Preserve aryMyArray(UBound(aryMyArray)+1)
aryMyArray(UBound(aryMyArray)) = Thing
Next Thing
The array datatype doesn't have a "search" function, so you'll have to write your own lookup loop.
For i = 0 To UBound(aryMyArray)
If aryMyArray(i) = LookupThing Then...
Next i
Peter
------------------------------------------------------
Work smarter, not harder.
|