VBA 21Apr
VBA 21Apr
Where,
Lower bound is the lowest index of the array,
Upper bound is the highest index of the
array.
Method 1
Functions in Arrays
There are ten-plus in-built functions in an
array. These functions, help make our task
more handy and easy. Here, we will discuss
some of the most commonly used functions
in arrays in VBA.
Erase
The Erase function clears all the elements in
the array. For example, we have declared an
array of size 3, and assigned values to them.
Now, we want to erase all the elements in the
array, i.e. Erase arr.
Where,
Array_name = It is the name of the array,
whose elements are to be deleted.
ReDim
The ReDim() function is used to change the
dimension of the array. For example, initially,
we declared an array of size 3, now we want
to reassign the value of dimension to 2 in the
array. The ReDim arr(1 To 2) can be used to
achieve this.
Syntax: ReDim Array_name(row, column)
Where,
Join
The Join() function is used to join the
elements of arrays into one variable. For
example, an array of size 3, is created, and
the values, assigned, to them are 10, 20, and
30. Now, if we want to concatenate, all the
elements. Then, Join(arr) function can be
used. The final output of the program will be
102030.
Syntax: Join(Array_name)
Where,