Range has no values

There are limitations on the way you can specify the number of elements in an array. This error has the following cause and solution:

  • You specified your array boundaries incorrectly. For example, the following ranges are invalid:

      Dim MyArray(10 To -5)    ' Descending order not permitted. 
      Dim MyArray(0 To 0)        ' No elements in the array. 
    

    Check to be sure your syntax is correct. For example, the following range is valid:

      Dim MyArray(-5 To 10)
    

For additional information, select the item in question and press F1 (in Windows) or HELP (on the Macintosh).

Support and feedback

Have questions or feedback about Office VBA or this documentation? Please see Office VBA support and feedback for guidance about the ways you can receive support and provide feedback.