O'Reilly logo

Excel VBA Programming For Dummies, 5th Edition by John Walkenbach, Michael Alexander

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

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 ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required