You need to use the keyboard to enter data. In addition, you can work with menus and dialog boxes directly from the keyboard - a method that you might find easier if your hands are already positioned over the keys.
Input that you type from the keyboard appears in boldface - for example, enter =SUM(B2: B50) into cell B51.
More lengthy input usually appears on a separate line in a monospace font. For example, I might instruct you to enter the following formula:
This book contains many snippets of VBA code as well as complete procedure listings. Each listing appears in a monospace font; each line of code occupies a separate line. (I copied these listings directly from the VBA module and pasted them into my word processor.) To make the code easier to read, I often use one or more tabs to create indentations. Indentation is optional, but it does help to delineate statements that go together.
If a line of code doesn't fit on a single line in this book, I use the standard VBA line continuation sequence: At the end of a line, a space followed by an underscore character indicates that the line of code extends to the next line. For example, the following two lines are a single code statement:
If Right(ActiveCell, 1) = "!" Then ActiveCell _ = Left(ActiveCell, Len(ActiveCell) - 1)
You can enter this code either on two lines, exactly as shown, or on a single line without the underscore character.
FUNCTIONS, FILENAMES, AND NAMED RANGES
Excel's worksheet functions appear in uppercase font, like so: "Enter a SUM formula in cell C20." VBA procedure names, properties, methods, and objects appear in monospace font: "Execute the GetTotals procedure." I often use mixed upper- and lowercase to make these names easier to read.
I also use the monospace font for filenames and named ranges in a worksheet - for example: Open myfile.xlsm and select the range named data.
Was this article helpful?