Erase Statement

Reinitializes the elements of arrays

Syntax

Erase arraylist

The required arraylist argument is one or more comma-delimited array variables to be erased.

Remarks

Erase sets the elements of an array to Empty.

Example

This example uses the Erase statement to reinitialize the elements of arrays.

' Declare array variables.
Dim NumArray(10) As Integer         ' Integer array.
Dim StrVarArray(10) As String       ' Variable-string array.
Dim StrFixArray(10) As String * 10  ' Fixed-string array.
Dim VarArray(10) As Variant         ' Variant array.

Erase NumArray      ' Each element is set to Empty, which is equivalent to 0.
Erase StrVarArray ' Each element is set to Empty, which is equivalent to NULL. Erase StrFixArray ' Each element is set to Empty, which is equivalent to an empty string"". Erase VarArray ' Each element is set to Empty.

 

See Also

Dim Statement, ReDim Statement, Static Statement