Access UBound function

Returns a Long data type containing the largest available subscript for the indicated dimension of an array. The UBound function is used with the LBound function to determine the size of an array. Use the LBound function to find the lower limit of an array dimension.

Syntax
UBound (arrayname, [ dimension ])