The UBound function returns the upper limit for the number of elements in an array (the elements can be empty).
www.virtualsplat.com