Creating a simple macro...
If you frequently need to format individual cells in a particular way (for example, currency style in red Arial bold 12-point font), a simple recorded macro will do the trick. Use the following steps to create it:
- Select Tools, Macro, Record New Macro to display the Record Macro dialog box.
- In the Record Macro dialog box, type a descriptive Macro name (such as "RedCurrency"). By default, the macro will be stored and available only in the current workbook; if appropriate, open the Store macro in drop-down list and select either New Workbook (to store and use the macro only in a new empty workbook) or Personal Macro Workbook (to make the macro available in allworkbooks). If desired, edit the text in Description. When done, click the OK button to begin recording.
- The word "Recording" will appear on the status bar at the bottom of the Excel window to remind you that all keystrokes and mouse actions are now being recorded. Depending on how your system is configured, a Stop Recording toolbar may also appear in the window. If you make a mistake, simply correct it as you normally would and continue; both the mistake and its correction will become part of the macro, and may be edited out later if desired.
- Perform the actions necessary to complete the task. For this example, the actions are:
- Select Format, Cells to display the Format Cells dialog box, click the Number tab, select Currency in the Category list, and click the OK button; as an alternative, you may simply click the $ button on the Formatting toolbar.
- Select Format, Cells to display the Format Cells dialog box, click the Font tab and then:
- open the Color drop-down list and select the desired color;
- select Arial from the Font list;
- select Bold from the Font style list;
- select 12 from the Size list; and
- click the OK button.
- If the Stop Recording toolbar is visible, click its Stop Recording button; if the toolbar is not visible, select Tools, Macro, Stop Recording.
For more information and advanced processes about macros click here.
No comments:
Post a Comment