Chapter 7

Essential VBA Language Elements

IN THIS CHAPTER

Bullet Knowing when, why, and how to use comments in your code

Bullet Using variables and constants

Bullet Telling VBA what type of data you’re using

Bullet Getting familiar with arrays

Bullet Knowing why you may need to use labels in your procedures

Because VBA is a real, live programming language, it uses many elements common to all programming languages. In this chapter, you’re introduced to several of these elements: comments, variables, constants, data types, arrays, and a few other goodies. If you’ve programmed with other languages, some of this material will be familiar. If you’re a programming newbie, it’s time to roll up your sleeves and get busy.

Using Comments in Your VBA Code

A comment is the simplest type of VBA statement. Because VBA ignores these statements, they can consist of anything you want. You can insert a comment to remind yourself why you did something or to clarify some particularly elegant code you wrote.

Use comments liberally ...

Get Excel VBA Programming For Dummies, 5th Edition now with O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.