Chapter 5. Understanding Arrays

Declare an Array

If you have a group of related values of the same data type, you can declare them as an array. You declare an array in much the same way you declare other variables and, as with other variables, you can declare arrays as either local or global. You set the scope of an array with the Dim or Public statements. See the section "Understanding Variables and Data Types" in Chapter 3 for more information about setting the scope of a variable.

You can use arrays to store a group of related data. Using arrays simplifies your code because you can use one variable to store several values. For example, you can declare an array and use it to store all 12 months of the year instead of creating a separate variable ...

Get Excel® Programming: Your visual blueprint™ for creating interactive spreadsheets now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.