Range Interlinear with ReDim (VBA)

Could you explain to me why this simple VBA code crashes on the last line ("Subscript out of range"):

    Dim test() As Variant
    ReDim test(0, 1)
    test(0,0) = "key"
    test(0,1) = 1
    ReDim Preserve test(1, 1)
+5
source share
1 answer

Resize with Preserve. If you use Preserve, you can only resize the last dimension of the array, and for each other dimension you must specify the same binding that already exists in the existing array.

, , , . , , , Preserve.

+15

All Articles