如何用VBA代码获得数组具有多少维数
使用以下自定义函数即可:
Public Function NumberOfDimensions(ByRef arrRef As Variant) As Integer
Dim DimCount As Byte, j%
DimCount = 0
On Error GoTo ErrHandler
For j = 1 To 128
DimCount = DimCount + VBA.Abs(VBA.IsNumeric(UBound(arrRef, j)))
Next j
Exit Function
ErrHandler:
Err.Clear
NumberOfDimensions = DimCount
End Function
标签:Function,VBA,arrRef,维数,DimCount,数组
From: https://www.cnblogs.com/excelogy/p/17233315.html