clearing arrays

  • Thread starter Thread starter mike
  • Start date Start date
M

mike

This newsgroup has been a big help. Thanks. I have one
more question. I'm just beginning to use arrays.

I read one record in a spreadsheet, and if it meets
certain conditions, an array is populated. The array is
then written somewhere else.

We go to the next record and look for certain conditions.
If we find it, we need to populat the array again.
However, there may be fewer or more items in the array
each time.

How do I clear an array so that it is empty when i go to
the next record. thanks for the help
 
Mike,

Here's an example

ReDim aryMe(UBound(aryMe, 1))

--

HTH

Bob Phillips
... looking out across Poole Harbour to the Purbecks
(remove nothere from the email address if mailing direct)
 
Be sure to declare the array as a dynamic array; then you can simply
ReDim it, e.g.

Dim arr()
ReDim arr(5, 3)
'Load arr and write it to somewhere else
Erase arr 'This is optional, to be used if it's desirable
'to free memory before arr is used again
ReDim arr(7, 5)
'Load array and write it to somewhere

Alan Beban
 
Back
Top