无法更改数组的维数
下面这段程序中的:ReDim sj(1, add - 1)与ReDim Preserve sj(1, UBound(sj, 2) + add)都显示:无法更改数组的维数,应怎样修改,谢谢!
Private Sub Button10_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button10.Click
Dim sj() As Long
Dim dn As Long
Dim sjStr() As String
Dim str
Dim add As Integer
add = 300
dn = 0
ReDim sjStr(add - 1)
ReDim sj(1, add - 1)
For b = 1 To Rows-1
With Me.AxfpSpread1
.Row = b
.Col = 1
'Value数值,Text文本
str = .Value
End With
If str <> "" Then
If dn > UBound(sjStr) Then
ReDim Preserve sjStr(UBound(sjStr) + add)
ReDim Preserve sj(1, UBound(sj, 2) + add)
End If
sjStr(dn) = str
End If
Next b
End Sub
[此贴子已经被作者于2023-4-5 18:25编辑过]