All the variables discussed so far have been single-instance variables. Often, however, you may find it very useful to work with arrays. An array is a group of variables of the same type, sharing the same name. In this way, processing groups of related areas is easy. For example, you might want to have a group of variables that tracks the sales in each of your company’s four regions. You can declare a decimal variable for each region, plus one for the total sales across all regions, like this:
Dim Reg1Sales, Reg2Sales As Decimal Dim RegSales3, Reg4Sales As Decimal Dim TotalSales As Decimal
Then, if you want to calculate the total sales for all regions, you might use this code:
TotalSales = Reg1Sales + Reg2Sales + Reg3Sales + ...