Multidimensional Arrays : Multidimensional Arrays « Data Type « VBA / Excel / Access / Word






Multidimensional Arrays

 
Sub ArrayDemo()
    Dim myArray(9, 2) As Integer
    Dim I As Integer
    Dim J As Integer
    Dim myArray(99, 99) As Integer
    For J = 0 To 99      'Column index
        For I = 0 To 99      'Row index
            myArray(I, J) = Cells(I + 1, J + 1).Value
        Next I
    Next J
End Sub

 








Related examples in the same category

1.By nesting one more loop, you can use a three-dimensional array to hold the data from the rows and columns in multiple worksheets