UBOUND(arrayname [,dimension])

Returns the largest subscript in a given dimension of an array (Long).


arraynameThe array (Variant).
dimension(Optional) The number of the dimension to use (Long).

REMARKS
* You cannot prefix this function with "VBA."
* If "dimension" = 1, then the first dimension of the array is used.
* If "dimension" = 2, then the second dimension of the array is used.
* If "dimension" is left blank, then 1 is used.
* You can use the LBOUND function to find the lower limit of an array dimension.
* The equivalent .NET function is Microsoft.VisualBasic.Information.UBound
* This function is not available in Access.
* For the Microsoft documentation refer to docs.microsoft.com

Dim avTemporary(1 To 100, 0 To 3, -3 To 4) As String 

Debug.Print UBound(avTemporary) '= 100
Debug.Print UBound(avTemporary, 1) '= 100
Debug.Print UBound(avTemporary, 2) '= 3
Debug.Print UBound(avTemporary, 3) '= 4

© 2021 Better Solutions Limited. All Rights Reserved. © 2021 Better Solutions Limited Top