Returns the count of array fields, given the dimension, using UBound
Replacement function for UBound (has extra functionality and error handling)
Function CountArrayCol(avValues As Variant, Optional lDimension As Long = 1, Optional lDefault As Long = -1) As Long
' Purpose : Replacement function for UBound (has extra functionality and error handling)
' Inputs : avValues The array to find the UBound.
' lDimension Which dimension's upper bound to return
' [lDefault] The value to return if an error occurs
' Outputs : The upper bound of the array, or lReturnThis if an error occurs
CountArrayCol = lDefault
On Error Resume Next
CountArrayCol = UBound(avValues, lDimension)
On Error GoTo 0
End Function
' Purpose : Replacement function for UBound (has extra functionality and error handling)
' Inputs : avValues The array to find the UBound.
' lDimension Which dimension's upper bound to return
' [lDefault] The value to return if an error occurs
' Outputs : The upper bound of the array, or lReturnThis if an error occurs
CountArrayCol = lDefault
On Error Resume Next
CountArrayCol = UBound(avValues, lDimension)
On Error GoTo 0
End Function
avValues As Variant, Optional lDimension As Long = 1, Optional lDefault As Long = -1
Example: CountArrayCol(Arr(), 2)
Views 1,970
Downloads 672
CodeID
DB ID