12.3 Running Macros: Button, Shortcut and the Macros Dialog
Steps in Excel
- Macros dialog: Developer › Code › Macros (Alt + F8) › select › Run. Options… sets or changes the shortcut key.
- Shortcut key: use Ctrl + Shift + letter – plain Ctrl + letter can override Excel shortcuts like Ctrl + C.
- Button (Form Control): Developer › Controls › Insert › Form Controls › Button › draw it › the Assign Macro dialog opens › choose
FormatDailyReport› OK › right-click › Edit Text "Format Report". - Any shape as a button: Insert › Illustrations › Shapes › draw a rounded rectangle › type text › right-click › Assign Macro…
- Quick Access Toolbar: File › Options › Quick Access Toolbar › Choose commands from: Macros › Add › Modify… to pick an icon.
Worked example. On the Report sheet Zoya adds three shape-buttons: Format Report, Split by City, Combine Sheets, each assigned to a macro from 12.12 – the Nashik store manager can run them without opening the VBA Editor.
Ravindra Bagale's Tip
Macro la Ctrl + C kiwa Ctrl + V shortcut dila tar Excel cha copy-paste band hoto – aani khup students na kalat nahi ka! Nehmi Ctrl + Shift + letter vapra. Button var spasht nav liha ("Format Report"), "Button 1" nako – vaparnaryala kay hoil te kalla pahije.
Practice task
Assign your FormatHeader macro to a shape button and to the Quick Access Toolbar. Change its shortcut to Ctrl + Shift + F from the Macros dialog.