CountArrayCol

Returns the count of array fields, given the dimension, using UBound
Replacement function for UBound (has extra functionality and error handling)

CodeFunctionName
What is this?

Public

Not Tested

Imported
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

avValues As Variant, Optional lDimension As Long = 1, Optional lDefault As Long = -1

Example: CountArrayCol(Arr(), 2)

Views 1,967

Downloads 670

CodeID
DB ID

ANmarAmdeen
606
Attachments
Revisions

v2.0

Sunday
September
8
2019