请高手看看我写的这段代码哪里有问题,它老是说下标越界,实时错误9.小的不胜感激!!!
主要是下面显示的红色代码有问题.
Dim a(1 To 3) As Date
Private Sub cmdInp_Click()
For i = 1 To 3
a(i) = InputBox("输入日期", "输入框")
pic1.Print a(i)
Next i
End Sub
Private Sub cmdDpy_Click()
For i = 1 To 2
For j = i + 1 To 3
Max = i
If a(j) > a(Max) Then Max = j
t = a(i)
a(i) = a(Max)
a(Max) = t
Next j
Next i
For i = 1 To 3
pic2.Print a(i)
Next i
End Sub
Private Sub cmdSta_Click()
Dim b(1 To 12) As Integer
For j = 1 To 12
If j = Month(Val(a(i))) Then b(j) = b(j) + 1
Next j
For j = 1 To 12
pic3.Print ""; j; "月出现"; b(j); "次";
Next j
End Sub