VBA - Arrays

Arrays are a datatype that contains a list of values. These are useful when dealing with large sets of data.

In the above example the array is defined at each value will contain strings. Then each value is manually assigned. 

In this second example the array is set to the Variant datatype, this allows for a range of datatypes to be utilize. 

We also populate the array with an array of values.

Code Snipppet:

Sub a4_4_Array_2()

Dim x As Variant

x = Array("THIS", 2, 3.2)

MsgBox x(1)

End Sub

Related Sections

Python - Learn the python from the basics up. This fast track example code course will get you creating powerful python programs in no time.

Must Read Articles

VBA and Microsoft Excel - Getting the most out of excel with VBA programming
VBA and Microsoft Word - Getting the most out of word with VBA programming
Application Object - Using the applications features in your code.
Installing VBA and First Program - What do you need to start using visual basic application VBA.