Arrays
- 01:11
Understanding arrays in Excel VBA.
Downloads
No associated resources to download.
Transcript
An array is a set of indexed variables of a single type.
Although Excel VBA arrays can have up to 60 dimensions in practice, three dimensions are the maximum that you are likely to use.
Because of their huge capacity arrays provide an ideal vehicle for holding and processing large data sets.
If we are using an array, it must be declared first using dim.
In the first example, a one dimensional array is declared.
The array is named company and has space for three string elements.
The second example declares a two-dimensional array.
We can think of this two-dimensional array as a spreadsheet with three rows and two columns that has spaces for string elements.
The subsequent code is the beginning of the code to allocate items to each space in the array.