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