Option Base 1
Private Sub Command1_Click()
Dim n As Integer
Dim s()
n = InputBox("请输入学生人数的个数")
For i = 1 To n s(i) = InputBox("请输入第" & i & "个学生的学号") Print s(i)
Next
End Sub
为什么老是越界?
谢谢各位高手指点!!!
Private Sub Command1_Click()
Dim n As Integer
Dim s()
n = Val(InputBox("请输入学生人数的个数"))
If n = 0 Then Exit Sub
ReDim s(n)
For i = 1 To n s(i) = InputBox("请输入第" & i & "个学生的学号") Print s(i)
Next
End Sub
Option Base 1
Private Sub Command1_Click()
Dim n As Integer
Dim s()
n = InputBox("请输入学生人数的个数")
ReDim s(n)
For i = 1 To n s(i) = InputBox("请输入第" & i & "个学生的学号") Print s(i)
Next
End Sub