Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 989
Default 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

??
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2,202
Default 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

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 989
Default 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


  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 200
Default 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

??

  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 989
Default 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.



  #6   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 989
Default clearing an array

thanks. got it. it works for what I need.

"Alan Beban" wrote:

Erase arParameters


Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

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


Similar Threads
Thread Thread Starter Forum Replies Last Post
Clearing cells without clearing formulas marsjune68 Excel Discussion (Misc queries) 2 April 10th 09 07:39 PM
Clearing Array Contents Ken Hudson Excel Programming 1 May 5th 07 07:35 PM
Array for clearing checkboxes Richard Excel Programming 6 August 12th 05 08:37 AM
clearing array contents mark Excel Programming 15 June 8th 05 03:51 PM
vba clearing out values stored in array chick-racer[_44_] Excel Programming 2 December 1st 03 09:05 PM


All times are GMT +1. The time now is 03:01 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"