This doesn't work for me. May have to check element by element:I use
It basically puts all of the elements together into a string so if there is at least one value then the string will not be null.Code:If Join(Arr) <> "" Then ... 'The array contains some values
Option Base 1
Dim vArr(10) As Variant
Sub myMod()
For i = 1 To UBound(vArr, 1)
If IsEmpty(vArr(i)) Then Ct = Ct + 1
Next i
If Ct = UBound(vArr, 1) Then
MsgBox "Array is empty"
Else
MsgBox "Array is not empty"
End If
End Sub
Dim vArr(10) As Variant
Sub myMod()
For i = 1 To UBound(vArr, 1)
If Not IsEmpty(vArr(i)) Then
MsgBox "Array is not empty"
Exit For
End If
Next i
'http://www.mrexcel.com/forum/showthread.php?t=330424
Public Function IsBounded(vArray As Variant) As Boolean
'If the variant passed to this function is an array, the function will return True;
'otherwise it will return False
On Error Resume Next
IsBounded = IsNumeric(UBound(vArray))
End Function
Ones the long type dynamic array is dimensioned it contains zero values.Dynamic array, with um... Long data, I think. 5- to 7-digit numbers.
Dim MyArr() ' As Long
Function IsDimentioned(Arr) As Boolean
IsDimentioned = (Not MyArr) <> -1
End Function
Sub Test()
Debug.Print IsDimentioned(MyArr)
ReDim MyArr(1 To 7)
Debug.Print IsDimentioned(MyArr)
End Sub