Subscript out of range

When accessing an array, either the number of subscripts does not match the given array's defined dimensions, or the size of one or more subscripts does not match the given array's bounds.

  • If the subscripts are correct, redefine the array dimensions or bounds using the ReDim statement.
  • If the array dimensions and bounds are correct, the subscripts must be respecified. For example:
Dim TiArr(-1 To 1)
Print TiArr(0, 0)         'Error. Array is defined as having one
                          'dimension, and is being accessed as a
                          'two-dimensional array.
Print TiArr(-2)           'Error. The specified subscript falls outside of
                          'the array's defined bounds.