elements in an array
Chip Pearson wrote:
The following function will return the number of elements in the first
dimension of the array Arr or 0 if Arr is a dynamic array that has not
yet been allocated or has been cleared with Erase, or -1 if Arr is not
an array.
Function NumElements(Arr As Variant) As Long
Dim LB As Long
If IsArray(Arr) = False Then
Suggest
If Not TypeName(Arr) Like "*()" Then
instead of the last line above. Otherwise, if Arr is a multi-celled
range, the function will return 0 rather than -1
BTW, I still don't know whether the OP was referring to the number of
elements or the number of non-empty elements, since I don't know what
alen(myarray,1) returns in FoxPro.
Alan Beban
|