Macros In Excel 2007

Excel macros can save you a heap of time.

Also, they can reduce the amount of mistakes you make.

Creating Macros In Excel 2007

Macros in Excel 2007 are ideal for performing the same tasks over and over again. Not only do they save you time and banish tedious and repetitive tasks, they also cut down the number of mistakes you make. Creating an Excel macro involves recording all the steps you perform to complete a task. You then run the macro instead of performing the steps manually.

There are two ways to create a macro:

  1. Use the macro recorder to record the commands and actions you perform.
  2. Use the visual basic editor to create the macro from scratch

Using the macro editor can be tricky, as it involves coding the macro. By far the quickest and easiest method is to use the macro recorder, as all that requires is to start the recording, perform the steps in the task and end the recording. Once the macro is ready for use, you can assign it to an object such as a toolbar button. You can then run the macro by clicking the button.

Create A Macro Using The Macro Recorder

To record a macro in Excel 2007, you need the Developer tab in the ribbon, but the default configuration of Excel does not show this tab. To get the Developer tab showing in the ribbon, click the Office button > Excel Options > Popular, and check the Show Developer tab in the Ribbon box. When you click OK, the new tab should appear.

Click the Developer tab > Code > Record Macro.

Create An Excel Macro

In the macro name input box, give the macro a name. Note that though the first character must be a letter, subsequent characters can be letters, numbers or underscores. Spaces are not allowed in macro names, but underscores make good separators. If you want to assign a keyboard shortcut (like ctrl-c to copy) you can do this using the Shortcut key input box. You have two options for places to store the macro:

  1. This workbook - the macros can only be used in the workbook you are currently editing. This is fine if he macro is a one-off.
  2. Personal macro workbook - this is a repository of macros you create and is accessible from any workbook you are editing. If you are creating a macro that can be used in different workbooks, this is the place to store it.

Type a meaningful description in the Description input box. Macro1 is not a good description as it doesn't describe what the macro does. Once all details about the macro have been entered, click OK. You can now start performing all the steps in the required task. When you have completed the steps, click Stop Recording (in the same Code group on the Developer tab).

To view all macros that have previously been created, click Developer > Code > Macros.

View Macros In Excel 2007

Using this window you can perform the following actions on all existing macros:

  • Run
  • Step Into (this option debugs the macro using the visual basic editor)
  • Edit (this option brings up the visual basic editor)
  • Delete
  • Edit the macros options (only the shortcut key and description that were assigned)

Using this window, you can also create new macros