при объявлении его с пустым(), то вы можете позже ReDim его с любыми размерами, которые вы хотите
создать следующий проект, запустите его, нажмите на кнопку 2 команды, и посмотреть на показанных данных
'1 form with
' 2 command buttons : name=Command1, name=Command2
' 1 label : name=Label1
Option Explicit
Private mintVal() As Integer
Private Sub Command1_Click()
Dim intIndex1 As Integer, intIndex2 As Integer, intIndex3 As Integer
ReDim mintVal(5, 3, 4) As Integer
For intIndex1 = 0 To UBound(mintVal, 1)
For intIndex2 = 0 To UBound(mintVal, 2)
For intIndex3 = 0 To UBound(mintVal, 3)
mintVal(intIndex1, intIndex2, intIndex3) = intIndex1 + intIndex2 + intIndex3
Next intIndex3
Next intIndex2
Next intIndex1
ShowVals3
End Sub
Private Sub Command2_Click()
Dim intIndex1 As Integer, intIndex2 As Integer
ReDim mintVal(3, 7) As Integer
For intIndex1 = 0 To UBound(mintVal, 1)
For intIndex2 = 0 To UBound(mintVal, 2)
mintVal(intIndex1, intIndex2) = intIndex1 * intIndex2
Next intIndex2
Next intIndex1
ShowVals2
End Sub
Private Sub Form_Resize()
Dim sngWidth As Integer, sngHeight As Single
Dim sngCmdWidth As Single, sngCmdHeight As Single
sngWidth = ScaleWidth
sngCmdHeight = 495
sngCmdWidth = sngWidth/2
sngHeight = ScaleHeight - 495
Label1.Move 0, 0, sngWidth, sngHeight
Command1.Move 0, sngHeight, sngCmdWidth, sngCmdHeight
Command2.Move sngCmdWidth, sngHeight, sngCmdWidth, sngCmdHeight
End Sub
Private Sub ShowVals2()
Dim intIndex1 As Integer, intIndex2 As Integer
Dim strShow As String
strShow = ""
For intIndex1 = 0 To UBound(mintVal, 1)
strShow = strShow & CStr(mintVal(intIndex1, 0))
For intIndex2 = 1 To UBound(mintVal, 2)
strShow = strShow & "," & CStr(mintVal(intIndex1, intIndex2))
Next intIndex2
strShow = strShow & vbCrLf
Next intIndex1
Label1.Caption = strShow
End Sub
Private Sub ShowVals3()
Dim intIndex1 As Integer, intIndex2 As Integer, intIndex3 As Integer
Dim strShow As String
strShow = ""
For intIndex1 = 0 To UBound(mintVal, 1)
For intIndex2 = 0 To UBound(mintVal, 2)
strShow = strShow & CStr(mintVal(intIndex1, intIndex2, 0))
For intIndex3 = 1 To UBound(mintVal, 3)
strShow = strShow & "," & CStr(mintVal(intIndex1, intIndex2, intIndex3))
Next intIndex3
strShow = strShow & vbCrLf
Next intIndex2
strShow = strShow & vbCrLf
Next intIndex1
Label1.Caption = strShow
End Sub
http://www.vb-helper.com/howto_net_declare_arrays.html – Elior
Да, вам нужно использовать варианты, по крайней мере, для «внешнего массива». Преимущество использования массивов массивов, конечно, состоит в том, что у вас могут быть оборванные массивы (подмассивы могут иметь разные значения LBound/UBound, а не одно и то же для всех). – Bob77
Попробуйте массив UDT, если вам нужны конкретные типы для «столбцов». – wqw