![]() |
clearing an array
this seems like it should be easy, but a couple of things aren't working.
if you have declared an array: dim arParameters() as string and then later defined it: redim arParameters(1,2) as string how can you clear it out? Sort of like an UNdim ? Not just redefine it to another value, but put it back in the state it was in in the first place, right after the dim arParameters() as string ?? |
clearing an array
this seems like it should be easy, but a couple of things aren't working.
if you have declared an array: dim arParameters() as string and then later defined it: redim arParameters(1,2) as string how can you clear it out? Sort of like an UNdim ? Not just redefine it to another value, but put it back in the state it was in in the first place, right after the dim arParameters() as string Use the Erase statement... Erase arParameters You might want to look it up in the help files as it works "differently" for dynamic as opposed to fixed arrays and what happens depends on the data type of the array. Rick |
clearing an array
Thanks!
I will look it up. 'Erase' ... almost like English. Thanks again. "Rick Rothstein (MVP - VB)" wrote: this seems like it should be easy, but a couple of things aren't working. if you have declared an array: dim arParameters() as string and then later defined it: redim arParameters(1,2) as string how can you clear it out? Sort of like an UNdim ? Not just redefine it to another value, but put it back in the state it was in in the first place, right after the dim arParameters() as string Use the Erase statement... Erase arParameters You might want to look it up in the help files as it works "differently" for dynamic as opposed to fixed arrays and what happens depends on the data type of the array. Rick |
clearing an array
Erase arParameters
Alan Beban mark wrote: this seems like it should be easy, but a couple of things aren't working. if you have declared an array: dim arParameters() as string and then later defined it: redim arParameters(1,2) as string how can you clear it out? Sort of like an UNdim ? Not just redefine it to another value, but put it back in the state it was in in the first place, right after the dim arParameters() as string ?? |
clearing an array
Thanks, Rick, that worked fine.
The problem I was having was that two variables that I thought would be totally out of scope and gone away when the code terminated, did not. But, I've reset the one in the code now, and the Erase statement that you suggested has taken care of that. |
clearing an array
thanks. got it. it works for what I need.
"Alan Beban" wrote: Erase arParameters |
All times are GMT +1. The time now is 08:09 AM. |
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com