我的vb程序运行时下标越界了,求高手帮忙指点一下!!
Dima,i%a=Array(1,3,5,7,9,11,13,15,17,19,21,23,25)n=UBound(a)x=Val(InputBox("要删除的数值为")...
Dim a, i%
a = Array(1, 3, 5, 7, 9, 11, 13, 15, 17, 19, 21, 23, 25)
n = UBound(a)
x = Val(InputBox("要删除的数值为"))
For i = 0 To n
If x = a(i) Then Exit For
Next i
k = i
For i = k To n - 1
a(i) = a(n + 1)
Next i
ReDim Preserve a(n - 1)
End Sub 展开
a = Array(1, 3, 5, 7, 9, 11, 13, 15, 17, 19, 21, 23, 25)
n = UBound(a)
x = Val(InputBox("要删除的数值为"))
For i = 0 To n
If x = a(i) Then Exit For
Next i
k = i
For i = k To n - 1
a(i) = a(n + 1)
Next i
ReDim Preserve a(n - 1)
End Sub 展开
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询