O'Reilly logo

Excel® 2010 Workbook for Dummies® by Greg Harvey

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 22. Using the Visual Basic Editor

In This Chapter

  • Getting familiar with the Visual Basic Editor

  • Editing a macro in the Visual Basic Editor

  • Adding interactivity to a macro with a dialog box that processes user input

  • Creating and using user-defined functions in the Visual Basic Editor

  • Saving user-defined functions as Excel add-ins

Visual Basic for Applications (usually known simply as VBA) is the official programming language of Excel that you can use to edit as well as to write new macros. The key to editing and writing macros in Visual Basic for Applications is its editing program, the Visual Basic Editor (often abbreviated VBE). The Visual Basic Editor offers a rich environment for coding and debugging VBA code whose interface rivals that of Excel itself in terms of features and complexity.

In this chapter, you get a chance to practice using the Visual Basic Editor to edit macros that you've recorded (see Chapter 21) as well as to enhance their basic functionality through the addition of interactivity. In addition, you get practice using the VBE to create your own custom functions known as user-defined functions (often abbreviated UDF).

Using the Visual Basic Editor

You can open the Visual Basic Editor in one of three ways:

  • Click the Visual Basic button in the Code group at the very beginning of the Developer tab on the Ribbon (Alt+LV).

  • Press Alt+F11.

  • Open the Macro dialog box (Alt+F8), select a macro to edit, and then click the Edit button.

Figure 22-1 shows the arrangement of the ...

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