The topic you requested is included in another documentation set. For convenience, it's displayed below. Choose Switch to see the topic in its original location.
Erase Statement (Visual Basic)
Used to release array variables and deallocate the memory used for their elements.
Required. List of array variables to be erased. Multiple variables are separated by commas.
statement can appear only at procedure level. This means you can release arrays inside a procedure but not at class or module level. Erase
statement is equivalent to assigning Erase to each array variable. Nothing
The following example uses the
statement to clear two arrays and free their memory (1000 and 100 storage elements, respectively). The Erase statement then assigns a new array instance to the three-dimensional array. ReDim
Dim threeDimArray(9, 9, 9), twoDimArray(9, 9) As Integer
Erase threeDimArray, twoDimArray
ReDim threeDimArray(4, 4, 9)