ArrayDimensions()
This returns the number of elements in an array's second dimension. It's not elegant, but it works.
Here is an example of how to call it:
v = Selection ' Quick and dirty way to create a two dimensional array
Debug.Print ArrayDimensions(v)
Here is the function
Function ArrayDimensions(ByVal vArray As Variant) As Long
' Description:Determine the ubound of an array's second dimension
' Inputs: vArray Array to determine # of dimensions
' Outputs: Me Success: # of dimensions
' Failure: 0
' Requisites: *None
' Example: ?ArrayDimensions(Selection)
' Date Ini Modification
' 09/11/12 CWH Initial Development
' Declarations
Const cRoutine As String = "ArrayDimensions"
Dim x As Long
Dim n As Long
' Error Handling Initialization
On Error GoTo ErrHandler
ArrayDimensions = 0
' Procedure
For x = 1 To 60000: n = LBound(vArray, x): Next
ErrHandler:
Select Case Err.Number
Case Is = NoError: 'Do nothing
Case Else:
Select Case DspErrMsg(cModule & "." & cRoutine)
Case Is = vbAbort: Stop: Resume 'Debug mode - Trace
Case Is = vbRetry: Resume 'Try again
Case Is = vbIgnore: 'End routine
End Select
End Select
End Function