Range has no values

This page is specific to the Visual Basic for Applications (VBA) Language Reference for Office 2010.

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).