thanks, I was changed. but I Not understand "Visual Basic for Applications arrays can have up to 60000"
For 1 To 60000, Is it need? If normal around <20 dimensions, Set 99 Is it enough?
any advice please!
Private Sub Command1_Click()
Dim myArr(0 To 99, 0 To 2, 0 To 6) As String
Debug.Print FindNumberOfDimensions(myArr), Time
Public Function FindNumberOfDimensions(ByRef Xarray() As String, _
Optional ByVal aroundDimension As Long = 9) As Long
'Dimensions Xarray as an array.
'Dim Xarray(1 To 10, 5 To 20, 256 To 300, 8, -5 To 0)
'Sets up the error handler.
On Error GoTo FinalDimension
'Visual Basic for Applications arrays can have up to 60000
'dimensions; this allows for that.
For DimNum = 1 To aroundDimension
'It is necessary to do something with the LBound to force it
'to generate an error.
ErrorCheck = LBound(Xarray, DimNum)
'FindNumberOfDimensions = DimNum
'The error routine.
MsgBox "The array has " & DimNum - 1 & " dimensions"
FindNumberOfDimensions = DimNum - 1