Excel VBA array subscript out of range error

今天调试一段EXCEL VBA代码,在使用数组时总出现下标越界的报错,害得我查了半天,后来我把vba的本地窗口打开了,一下子就发现问题了。
其实代码很简单,就不写注释了。

Excel VBA array subscript out of range error

当然,我能看出这个问题来,就是通过本地窗口,

Excel VBA array subscript out of range error
Note that the red arrow, Count is 0, so the array on the wrong friends.
To solve the problem is very simple, regular expressions wrong, Oh, one less point.

Excel VBA array subscript out of range error

呵呵,问题解决啦。

Guess you like

Origin blog.51cto.com/shadingyu/2460076