0% found this document useful (0 votes)
15 views

Working With Variables: What You Learn

This document discusses working with variables in VBA. It covers declaring variables and data types, variable scope, and arrays. It provides an example of a 2-dimensional array with monthly data for 3 companies. It prompts the learner to update a macro from a previous section to use variables instead of hard-coded values.

Uploaded by

nick gomez
Copyright
© © All Rights Reserved
Available Formats
Download as XLSX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
15 views

Working With Variables: What You Learn

This document discusses working with variables in VBA. It covers declaring variables and data types, variable scope, and arrays. It provides an example of a 2-dimensional array with monthly data for 3 companies. It prompts the learner to update a macro from a previous section to use variables instead of hard-coded values.

Uploaded by

nick gomez
Copyright
© © All Rights Reserved
Available Formats
Download as XLSX, PDF, TXT or read online on Scribd
You are on page 1/ 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