it doesnt like my code:
Dim n As Integer
Dim flag As Boolean
Dim i
Dim x() As Integer
n = InputBox("How many numbers do you want to be sorted?")
For i = 1 T开发者_开发知识库o n - 1 Step 1
x(i) = InputBox("Please enter a record")
Next i
I want to put values into x()
You need to use a ReDim to specify the size of x
as soon as you know it (ie after your first InputBox):
n = InputBox("How many numbers do you want to be sorted?")
ReDim x(n - 1)
Also, your For loop will be simpler to handle if it's zero based as in:
For i = 0 To n - 1 Step 1
精彩评论