If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

 
Go Back  dBforums > PC based Database Applications > Microsoft Excel > Array problem

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old 03-22-04, 15:47
Jim Lowe Jim Lowe is offline
Registered User
 
Join Date: Jan 2004
Posts: 5
Array problem

When you define an array as Dim Array() as Variant, you simply set up a placeholder for a future array.

How do you get excel to recognized that fact. I've got a a routine that needs to recognized that if the array has not been filled or ReDim'ed, it needs to exit the sub. Unfortunately, I can't seem to find the right function to do this. IsEmpty and IsNull do not work.

Any ideas
Reply With Quote
  #2 (permalink)  
Old 03-29-04, 12:07
SR22Mike SR22Mike is offline
Registered User
 
Join Date: Mar 2004
Location: Minnesota, USA, Earth
Posts: 65
Re: Array problem

Quote:
Originally posted by Jim Lowe
When you define an array as Dim Array() as Variant, you simply set up a placeholder for a future array.

How do you get excel to recognized that fact. I've got a a routine that needs to recognized that if the array has not been filled or ReDim'ed, it needs to exit the sub. Unfortunately, I can't seem to find the right function to do this. IsEmpty and IsNull do not work.

Any ideas
Hi,

I'm not familiar with any VBA function that keeps track of changes to an array. So, this isn't a function, but how about adding the variable dim ReDimmedArray as Boolean. Right after you initially dim the array set ReDimmedArray = FALSE. Right after the code redimentions the array, set ReDimmedArray = TRUE. Also, when data has been entered into the array, set ReDimmedArray = TRUE. So, this variable will start out as False, but whenever the array has been redimentioned or filled with data, ReDimmedArray will = TRUE.

In the routine you mentioned, set-up an IF...THEN...ELSE to test ReDimmedArray = TRUE (or FALSE).

I don't know the scope of the array, but whatever it is, I would set up ReDimmedArray in the same scope.

Hope this is helpful,
Mike
Reply With Quote
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

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 On