Using Array Function

The Array function can be used to create an array from an explicit list of constants.
If you want to use the Array function to declare a fixed array then you must declare the array as a Variant.
When the Array function is used, the variables have the variant datatype.

Dim arValues As Variant 
arValues = Array(50, 100, 150, 200)

Populating a Fixed Array

Once the array has been declared it can be populated.

Dim myArray(3) As Long 
myArray(0) = 50
myArray(1) = 100
myArray(2) = 150
myArray(3) = 200

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