Search notes:

VBA functions: lBound / uBound

lBound returns the index of the first element in an arrays. (Note: that's spelled ell-bound, not one-bound).
uBound returns the index of the last element in an arrays
These functions can also be applied on dictionaries.
option explicit

sub main() ' {

  ' declare an array of 6 longs, indexed from 0 to 5
    dim a_0_5(0 to 5) as long

  ' declare another array of 6 longs:
    dim a_3_8(3 to 8) as long

  ' declare another array. Since option base is not
  ' explicitely set, it defaults to 0, so the lower
  ' bound is 0.
     dim a_x_5(5)

    showBounds a_0_5 ' lBound: 0, uBound: 5
    showBounds a_3_8 ' lBound: 3, uBound: 8
    showBounds a_x_5 ' lBound: 0, uBound: 5

end sub ' }

sub showBounds(a as variant) ' {
    debug.print "lBound: " & lBound(a) ", uBound: " & uBound(a)
end sub ' }
Github repository about-VBA, path: /functions/xBound.bas

Dimensions of mulit-dimensional arrays

In order to determine the dimensions of multi-dimensional arrays, the second parameter (which is optional) must be used:
lBound(ary, 1) ' Lower bound of 1st dimension of array named ary
uBound(ary, 2) ' Upper bound of 2nd dimension of array named ary

See also

The default index for the first element in an array can be changed with the option base statement.
functions

Index