Читать книгу Excel Macros For Dummies онлайн
36 страница из 60
If you store macros in the Personal Macro Workbook, you don’t have to remember to open the Personal Macro Workbook when you load a workbook that uses macros. When you want to exit, Excel asks whether you want to save changes to the Personal Macro Workbook.
Assigning a macro to a button and other form controls
When you create macros, you may want to have a clear and easy way to run each macro. A basic button can provide a simple but effective user interface.
As luck would have it, Excel offers a set of form controls designed specifically for creating user interfaces directly on worksheets. There are several different types of form controls, from buttons (the most commonly used control) to scrollbars.
The idea behind using a form control is simple: You place a form control on a worksheet and then assign a macro to it — that is, a macro you’ve already recorded. When a macro is assigned to the control, that macro is executed, or played, when the control is clicked.
Take a moment to create a button for the AddTotalRelative macro you created earlier. Here’s how: