You are on page 1of 5

What you learn Working with Variables

Link Topic Covered What you Learn

Example Monthly Reporting ● Advantages of variables


● Data Types
DIM Declaring Variables, Arrays ● Declaring variables & Option Explicit
& Constants ● Object variables
● Variable Scope

Activity Activity: Update the Macro


you Created in the Last
Section to Use Variables
Monthly Reporting
4

Repeat Title:

Repeat Title:
Declaring Variables, Arrays & Constants

Below is an example of how a 2-dimensional array can look


The values in brackets are the positions of each value inside the array - given that the lower bound starts at 1.
First dimension is row and 2nd dimension is column.

Company A Company B Company C


Jan (1,1) (1,2) (1,3)
Feb (2,1) (2,2) (2,3)
Mar (3,1) (3,2) (3,3)
Apr (4,1) (4,2) (4,3)
May (5,1) (5,2) (5,3)
Jun (6,1) (6,2) (6,3)
Jul (7,1) (7,2) (7,3)
Aug (8,1) (8,2) (8,3)
Sep (9,1) (9,2) (9,3)
Oct (10,1) (10,2) (10,3)
Nov (11,1) (11,2) (11,3)
Dec (12,1) (12,2) (12,3)
Activity: Update the Macro you Created in the Last Section to Use Variables

Use the knowledge you've gained in this section and update the Hard-Coded SaveAs macro you created in the last section by i

Answer is included in the completed Macro-enabled file in Module "ProjectActivity"


created in the last section by including variables where you see fit.

You might also like