Is array allocated

I use a lot of arrays in my procedures and l use this procedure from Chip Pearson to check if the array has been allocated. IMO it is more efficient to check that before trying to do something with the array.
Author: Chip Pearson

Function IsArrayAllocated(arr As Variant) As Boolean

    On Error Resume Next
    IsArrayAllocated = IsArray(arr) And Not IsError(LBound(arr, 1)) And LBound(arr, 1) <= UBound(arr, 1)
    
End Function

Address

Brookfield,
55 Heath Drive
Brookwood, Surrey
GU24 0HQ England

Scroll to Top