Function DofArray(arr) As Integer
On Error Resume Next
'判断是否数组
If Not IsArray(arr) Then
DofArray = -1
Exit Function
End If
'利用出错来判断
For i = 1 To 60
aa = UBound(arr, i)
If Err.Number <> 0 Then
DofArray = i - 1
Exit Function
End If
Next
End Function
Function arr1to2(arr)
lv = UBound(arr) + 1 '注意一维数组和维数的起始数字的不同
ReDim arr1(1 To lv, 1 To 2)
For i = 1 To lv
arr1(i, 1) = arr(i - 1)
Next
arr1to2 = arr1
End Function