diddom 发表于 2012-6-6 07:47:16

Redimensioning a two-dimensional array

Dim myArray(), nDims, iSelection

iSelection = vbYes
Do While iSelection <> vbCancel

   iSelection = MsgBox("Create 2 dimension array?", _
            vbQuestion Or vbYesNoCancel, "Dynamic Arrays")

   If iSelection = vbYes Then
      ReDim myArray(10,5)
      nDims = 2
   ElseIf iSelection = vbNo Then
      ReDim myArray(4,10,2)
      nDims = 3
   End If
   
   If iSelection <> vbCancel Then
      MsgBox "The upper bound of dimension " & nDims & _
             " is " & UBound(myArray, nDims)
   End If
Loop
页: [1]
查看完整版本: Redimensioning a two-dimensional array