ReDiming an array in VBA

后端 未结 2 1954
逝去的感伤
逝去的感伤 2021-01-26 23:47

I have a serious problem with resizing a 2-dimensional array in VBA. I\'ve done a lot of reading about this (popular) issue, but still I can\'t figure out what\'s wrong in my co

2条回答
  •  情话喂你
    2021-01-27 00:42

    It's because you can't change the lower bound of the second dimension, you need to keep it the same..

    You declare ReDim distinctList(0 To 1, 0 To j) at the top

    when you redim, you need to keep lower bound of the second dimension at 0

    ReDim Preserve distinctList(0 To 1, 0 To UBound(distinctList, 2) + 1)
    

提交回复
热议问题