Article ID: 152288
Article Last Modified on 10/11/2006
Sub NumberOfDimensions()
'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 60000
'It is necessary to do something with the LBound to force it
'to generate an error.
ErrorCheck = LBound(Xarray, DimNum)
Next DimNum
Exit Sub
' The error routine.
FinalDimension:
MsgBox "The array has " & DimNum - 1 & " dimensions"
End Sub
163435 VBA: Programming Resources for Visual Basic for Applications
Additional query words: 5.00a 5.00c 8.00 XL97 XL98 XL7 XL5 statistical error XL
Keywords: kbdtacode kbhowto kbprogramming KB152288