PC Review


Reply
Thread Tools Rate Thread

clearing an array

 
 
=?Utf-8?B?bWFyaw==?=
Guest
Posts: n/a
 
      25th Jun 2007
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

??
 
Reply With Quote
 
 
 
 
Rick Rothstein \(MVP - VB\)
Guest
Posts: n/a
 
      25th Jun 2007
> 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

 
Reply With Quote
 
=?Utf-8?B?bWFyaw==?=
Guest
Posts: n/a
 
      25th Jun 2007
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
>
>

 
Reply With Quote
 
Alan Beban
Guest
Posts: n/a
 
      25th Jun 2007
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
>
> ??

 
Reply With Quote
 
=?Utf-8?B?bWFyaw==?=
Guest
Posts: n/a
 
      25th Jun 2007
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.

 
Reply With Quote
 
=?Utf-8?B?bWFyaw==?=
Guest
Posts: n/a
 
      25th Jun 2007
thanks. got it. it works for what I need.

"Alan Beban" wrote:

> Erase arParameters


 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
clearing an array NDBC Microsoft Excel Programming 7 5th Sep 2009 05:43 AM
clearing array variables and using an array to determine min value NDBC Microsoft Excel Programming 7 4th Sep 2009 09:43 PM
Clearing an Array Cloudfall Microsoft Excel Discussion 5 22nd Mar 2006 12:37 AM
Clearing an Array =?Utf-8?B?Qm9i?= Microsoft Excel Programming 4 23rd Nov 2004 12:26 PM
Clearing an Array... Gary Microsoft Dot NET 4 13th Nov 2004 05:12 AM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 01:40 PM.