View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
Jacob Skaria Jacob Skaria is offline
external usenet poster
 
Posts: 8,520
Default is array redimmed?

Dear Stefi

May be you can check the number of dimensions using the below proc. and if
it is 0 you can Redim...

Dim myarray()
If GetNumberOfDimensions(myarray) = 0 Then
ReDim myarray(10)
End If


Function GetNumberOfDimensions(arrTemp) As Long
On Error GoTo ErrHandler
Do
intTemp = intTemp + 1
ErrorCheck = UBound(arrTemp, intTemp)
Loop
ErrHandler:
GetNumberOfDimensions = intTemp - 1
End Function


If this post helps click Yes
---------------
Jacob Skaria


"Stefi" wrote:

The problem is that ISArray() returns TRUE either after Dim myarray() or
Redim Preserve myarray(x). I want to determine that Redim Preserve
myarray(x) has already been issued or not.

Thanks,
Stefi


€˛Jacob Skaria€¯ ezt Ć*rta:

ISArray() will return TRUE

Dim myArray()
Msgbox IsArray(myArray)

If this post helps click Yes
---------------
Jacob Skaria


"Stefi" wrote:

Hi All.

I want to use a one dimension dynamic array, so my declaration is:

Dim myarray()

Redim myarray(x) changes it to a real array.
But how can I determine the state of myarray when it was not redimmed yet .

Thanks,
Stefi