Answers for "vba ubound array 2-dimensional"

VBA
3

excel vba ubound on a multidimensional array

'The VBA UBound() function returns the max index of an array.

MsgBox UBound(vArr)			'<--max index of the first dimension

'There is an optional second argument called rank (that defaults to: 1) 
'that specifies the dimension:

MsgBox UBound(vArr, 2)		'<--max index of the second dimension

'VBA array can have up to 60 dimensions.

'All of the above also applise to the LBound() function.
Posted by: Guest on April-04-2020
1

vba ubound array 2-dimensional

Dim arr(1 To 4, 1 To 3) As Variant
Debug.Print UBound(arr)     ' returns 2
Debug.Print UBound(arr, 1)  ' returns 4
Debug.Print UBound(arr, 2)  ' returns 3
Posted by: Guest on January-24-2021

Code answers related to "vba ubound array 2-dimensional"

Code answers related to "VBA"

Browse Popular Code Answers by Language