新建From1(窗体),新建Command1(按钮CommandButton),代码:
Private Sub Command1_Click() Dim i As Integer Dim arr() As Integer ReDim arr(1) For i = 0 To UBound(arr) Debug.Print i ReDim Preserve arr(5) Next End Sub
运行结果:
0 1
看来没变成5。