ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   clearing arrays (https://www.excelbanter.com/excel-programming/292580-clearing-arrays.html)

mike

clearing arrays
 
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

Bob Phillips[_6_]

clearing arrays
 
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)

"mike" wrote in message
...
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




Alan Beban[_4_]

clearing arrays
 
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

mike wrote:
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




All times are GMT +1. The time now is 10:20 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com