Dim Definition

Syntax

Dim [WithEvents] vardeclaration[, ...]

Group

Declaration

Description

Dimension var arrays using the dimensions to establish the minimum and maximum index value for each dimension. If the dimensions are omitted then a scalar (single value) variable is defined. A dynamic array is declared using ( ) without any dimensions. It must be ReDimensioned before it can be used.

Related Topics


Sub DoIt(Size)
    Dim C0, C1(), C2(2,3)
    ReDim C1(Size+1) ' dynamic array
    C0 = 1
    C1(0) = 2
    C2(0,0) = 3
    Debug.Print C0; C1(0); C2(0,0) ' 1 2 3
End Sub
 
Sub Main
    DoIt 1
End Sub