redimension multidimensional arrays in Excel VBA

后端 未结 4 1204
难免孤独
难免孤独 2021-01-28 02:59

Take a look at the following code. What my problem is is that I can\'t figure out how to redimension the n integer and the b integer. What I\'m doing is the array sent1 is alr

4条回答
  •  耶瑟儿~
    2021-01-28 03:26

    There are two issues in your code:

    1. When you Dim an array without specifying the lower bound it will by default be 0 based (unless you have specified Option Base 1). When explicitly specified, lower bound can be any number, not just 0 or 1
    2. For a multi dimensioned array, Redim Preserve can only change the last dimension, and then only the upper bound.

    In general, I find it better to always specify Lower and Upper bounds, eg

    Redim MyArray(1 to 10, 0 to 99)
    

提交回复
热议问题