Referencing Elements in a Multi-dimensional Array
Sub MultiDimArray()
Dim i As Integer
Dim j As Integer
Dim intNum() As Integer 'Create a dynamic array
ReDim intNum(2 To 3, 3 To 5) 'Resize the array
For i = 2 To 3 'Populate the array
For j = 3 To 5
intNum(i, j) = i ^ j
Next j
Next i
For i = 2 To 3 'Print the contents...
For j = 3 To 5 '...of the array
Debug.Print i & "^" & j & "=" & intNum(i, j)
Next j
Next i
End Sub
Related examples in the same category