Page 744 - Excel 2013 All-in-One For Dummies
P. 744
726 Using the Visual Basic Editor
5. Click the Save button on the Quick Access toolbar to save the changes
to the modified macro if it’s stored as part of the current workbook.
If you modified a global macro saved as part of the Personal Macro Workbook, you have to exit Excel in order to save your changes to the macro. When you click the Excel program window’s Close button or press Alt+FX or Alt+F4, Excel displays an alert dialog box asking whether you want to save the changes you made to the personal.xlsb file. Click the Yes button to save your macro modifications as you close down Excel.
Keep in mind that Excel automatically hides the Personal Macro Workbook when you exit Excel if you don’t click the Hide command button on the View tab or press Alt+WH when the PERSONALSB workbook is active sometime before exiting the program. This means that you must remember to click the Unhide command button on the View tab (Alt+WU) and select this personal macro workbook in the Unhide dialog box to make it visible before the next time you launch Excel and need to edit any of its macros during any subse- quent editing session.
Finding and replacing code in the macro
You can use the Find feature in the Visual Basic Editor to quickly locate the statements or properties that need editing in your macro. You open the Find dialog box, shown in Figure 2-3, by choosing Edit➪Find on the menu bar, clicking the Find button on the Standard toolbar, or by pressing Ctrl+F. This dialog box is very similar to the one you use when finding entries in your Excel spreadsheet. The main difference is that the Find dialog box gives you different choices for what to search for (in addition to the familiar options for finding whole words only and matching case):
✦ CurrentProcedureoptionbuttontosearchonlythecurrentprogramming procedure in the Code window
✦ Current Module option button to search only the macros in the current module (the default)
✦ Current Project option button to search all the macros in all modules within the current project
✦ Selected Text option button to search only the text that you’ve selected in the Code window (this option is not available unless you’ve selected a block of text in the current code)