Horje
vba array length Code Example
vba array length
Dim YourArray
YourArray = Array("a", "b", "c")
Debug.Print UBound(YourArray) - LBound(YourArray) + 1
excel vba determine number of elements in an array
'Since VBA arrays can have ANY integer value (from -2147483648 to 
'2147483647) for the lower index in the range for a rank,
'the only sure fire way to determine how many elements is in the array
'is to calculate the value:

MsgBox UBound(Arr) - LBound(Arr) + 1		'<--for elems in 1D array

MsgBox UBound(Arr, 1) - LBound(Arr, 1) + 1	'<--for rows in 2D array
MsgBox UBound(Arr, 2) - LBound(Arr, 2) + 1	'<--for cols in 2D array




3

Related
string to date vb Code Example string to date vb Code Example
vba copy paste value only Code Example vba copy paste value only Code Example
excel-vba how to convert a column number into an excel column Code Example excel-vba how to convert a column number into an excel column Code Example
vba code to remove duplicates from a column Code Example vba code to remove duplicates from a column Code Example
excel vba check if directory exists Code Example excel vba check if directory exists Code Example

Type:
Code Example
Category:
Coding
Sub Category:
Code Example
Uploaded by:
Admin
Views:
12