Skip to content

Latest commit

 

History

History
39 lines (23 loc) · 1.54 KB

array-already-dimensioned.md

File metadata and controls

39 lines (23 loc) · 1.54 KB
title keywords f1_keywords ms.assetid ms.date ms.localizationpriority
Array already dimensioned
vblr6.chm1040055
vblr6.chm1040055
fcf3762f-3f3f-6182-a7c9-4f055991d2c1
06/08/2017
medium

Array already dimensioned

A static array can only be dimensioned once. This error has the following causes and solutions:

  • You attempted to change the dimensions of a static array with a ReDim statement; only dynamic arrays can be redimensioned. Either remove the redimensioning or use a dynamic array. To define a dynamic array, use a Dim, Public, Private, or Static statement with empty parentheses.

    For example: Dim MyArray() In a procedure, you can define a dynamic array with the ReDim or Static statement using a variable for the number of elements:

    Dim MyArray() 
    
      ReDim MyArray(n) 
    

    In a procedure, you can define a dynamic array with the ReDim or Static statement using a variable for the number of elements: ReDim MyArray(n)

  • An Option Base statement occurs after array dimensions are set. Make sure any Option Base statement precedes all array declarations.

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

[!includeSupport and feedback]