Using Labels

In early versions of BASIC, every line of code required a line number. For example, if you were writing a BASIC program in the '70s (dressed, of course, in your bell bottoms) it may have looked something like this:

010:

LET X=5

020:

LET Y=3

030:

LET Z=X*Y

040:

PRINT Z

050:

END

VBA permits the use of such line numbers and it even permits text labels. You don't typically use a label for each line, but you may occasionally need to use a label. For example, insert a label if you use a GoTo statement (which I discuss in Chapter 10). A label must begin with the first nonblank character in a line and end with a colon.

The information in this chapter becomes clearer as you read subsequent chapters. If you want to find out more about VBA language elements, I refer you to the VBA Help system. You'll find as much detail as you need, or care to know.

0 0

Post a comment