ReDim Statement /text/sbasic/shared/03102101.xhp
ReDim statement

ReDim Statement

Declares or redefines variables or arrays.
ReDim Statement diagram ReDim [Preserve] variable [(start To end)] [As type-name][, variable2 [(start To end)] [As type-name][,...]] Optionally, add the Preserve keyword to preserve the contents of the array that is redimensioned. ReDim can only be used in subroutines. Example: Sub ExampleRedim Dim iVar() As Integer, iCount As Byte ReDim iVar(5) As Integer For iCount = 1 To 5 iVar(iCount) = iCount Next iCount ReDim iVar(10) As Integer For iCount = 1 To 10 iVar(iCount) = iCount Next iCount End Sub