Unit 30: Macros

Recording a macro is like programming a phone number into your cell phone. You first manually dial and save a number. Then when you want, you can redial those numbers with the touch of a button. Just as with numbers on a cell phone, you can record your actions in Excel while you perform them. While you record, Excel gets busy in the background, translating your keystrokes and mouse clicks to written VBA code. After you’ve recorded a macro, you can play back those actions anytime you wish. This Part serves as an introduction to Excel Macros and VBA in general.



Becoming Familiar with Macro Recording Basics

To start recording your first macro, you need to first find the Macro Recorder, which is on the Developer tab. Unfortunately, Excel comes out of the box with the Developer tab hidden — you may not see it on your version of Excel at first. If you plan to work with VBA macros, you’ll want to make sure that the Developer tab is visible. To display this tab

  1. Choose Office Excel Options.

  2. In the Excel Options dialog box, select Customize Ribbon.

  3. In the list box on the right, place a check mark next to Developer.

  4. Click OK to return to Excel.

Here are the four parts of the Record Macro dialog box:

Macro Name: This should be self-explanatory. Excel gives a default name to your macro, such as Macro1, but you should give your macro a name more descriptive of what it actually does.

Format Table.

Shortcut Key: Every macro needs an event, or something to happen, for it to run. This event can be a button press, a workbook opening, or in this case, a keystroke combination. When you assign a shortcut key to your macro, entering that combination of keys triggers your macro to run. This is an optional field.

Store Macro In: This Workbook is the default option. Storing your macro in This Workbook simply means that the macro is stored along with the active Excel file. The next time you open that particular workbook, the macro is available to run. Similarly, if you send the workbook to another user, that user can run the macro as well (provided the macro security is properly set by your user — more on that later in this Part, in the section titled “Looking at Other Macro Recording Concepts”).

Description: This is an optional field, but it can come in handy if you have numerous macros in a spreadsheet or if you need to give a user a more detailed description about what the macro does.

UNIT 30 – Macros

There aren't any posts currently published in this category.