Wrong number of dimensions
You must reference an array with indexes corresponding to the same number of dimensions as appear in the array's declaration. This error has the following cause and solution:
- You referred to an array with a different number of dimensions than it actually contains. For example, referring to an array as
X(2,4)
(an array with two dimensions) when it has been defined asDim X(5)
(an array with one), generates this error. Check the declaration of the array and, in the reference, include one index for each dimension in the declaration.
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.