Microsoft Office Tutorials and References
In Depth Information
Recording Your First Macro
If all goes well, the AddDataBars macro plays back your actions to a T and applies the data bars as
designed (see Figure 13-6).
Figure 13-6: Your macro applied data bars automatically!
You can now call up the Macro dialog box again and test the RemoveDataBars macro shown in
Figure 13-7: The RemoveDataBars macro will remove the applied data bars.
Assigning a macro to a button
When you create macros, you want to give your audience a clear and easy way to run each macro. A
button, used directly in the dashboard or report, can provide a simple but effective UI.
Excel Form controls (refer to Chapter 12 for more information) enable you to create UI directly on
your worksheets, simplifying work for your users. Form controls range from buttons (the
mostcommonly used control) to scroll bars and check boxes.
For a macro, you can place a Form control in a worksheet and then assign that 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 , each time the control is clicked.