Page 310 - Excel Workbook for Dummies
P. 310

33_798452 ch23.qxp  3/13/06  7:51 PM  Page 293

                                                               Chapter 23



                                                     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





                                         isual Basic for Applications (usually known simply as VBA) is the official programming
                                    Vlanguage 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 22) 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 two ways:

                                        Choose the Tools➪Macro➪Visual Basic Editor menu command or do the equivalent by
                                         pressing the shortcut key combination Alt+F11
                                        Click the Visual Basic Editor button on the Visual Basic toolbar (displayed by choosing
                                         View➪Toolbars➪Visual Basic — shown in Figure 23-1)
   305   306   307   308   309   310   311   312   313   314   315