Varian VBA Len

Public Function ArrayLen(arr As Variant) As Long
    If IsEmpty(arr) Then
        ArrayLen = 0
    Else
        ArrayLen = UBound(arr) - LBound(arr) + 1
    End If  
End Function
VasteMonde