Lesson 1 - Variables, Constants and Data types

Outcome of this Lesson

Learn about Variables and Constants.

They are building blocks that you need to know.

When you want to control program flow, you need to know how to use Variables and Constants.

You also need to have a grasp of the different Data Types in Excel.

So that you can create the right type of variables or constants for your program.

Let’s look at the difference:


Variables vs Constants

Variables are like named containers for your data.

  • You can think of a variable as a box.
  • Data can be placed into the box and taken out.
  • Just like you can take stuff into and out of a real box.
  • The value of a variable can be changed while a program is running.

Constants are fixed specific values.

  • Imagine an ink stamp that’s set (either in stone or rubber).
  • You make it once and it’s going to stamp the same thing, forever.
  • Just ink it and stamp.
  • Constants cannot be changed when a program is running.


Data Types

The video shows types of variable and constant in Excel VBA.

You will probably use these most often:

  • Long (whole number) example = 1,250
  • String (text) example = “This is some text”
  • Object example = Worksheet

Write your comments and feedback below

  • If you have questions or comments about this lesson, write it in the section below.
  • Alternatively you can email the instructor Victor at [email protected]

Complete and Continue  
Discussion

2 comments