Defining Custom Format Styles

Problem

You find yourself applying the same formats repeatedly to different cells and would like to save time when doing so.

Solution

Define your own custom style and apply it to cells, taking care of many format settings all in one step.

Discussion

Select Format images/U2192.jpg border=0> Style from the main menu bar to open the Style dialog box as shown in Figure 1-17.

Figure 1-17. Style dialog box

The drop-down combo box next to the "Style name" label contains a list of predefined styles that you can apply to cells. Some of these are familiar, including the normal cell style along with currency and percent styles. You can add your own style to this list. Click the combo box, type in a unique name for your new style, and then press the Add button. Now you can check off the format options you want to include in your style and modify the format settings by pressing the Modify button. Pressing the Modify button opens the Format Cells dialog box (see Figure 1-6 in Recipe 1.3). You can make any format selection you desire and close this dialog box when done. The settings you specified will be applied to your custom style.

Once your style is defined, you have a few options for actually using it to format cells. One way to apply your custom style is to select the desired cell (or cells) and then select Format images/U2192.jpg border=0> Style... from the main menu bar to open the Style dialog box again. There you can select your desired style and press OK to close the dialog box. Your style will then be applied to the selected cell (or cells).

A faster approach involves adding a style drop-down list component to one of the toolbars on the main window so that you can simply select cells and then select a style to apply from the toolbar.

To add a style drop-down list to a toolbar, select View images/U2192.jpg border=0> Toolbar images/U2192.jpg border=0> Customize... from the main menu bar to open the Customize dialog box. Select the Commands tab (shown in Figure 1-18).

Figure 1-18. Customize dialog box

Now select Format from the Categories list to show the format commands. From the Commands list look for the Style drop-down listbox shown in Figure 1-18. Don't confuse it with the Style... dialog box command. Click and drag the Style listbox control from the Commands list over to any toolbar, preferably the format toolbar, on Excel's main window. After you close the Customize dialog box, that listbox will be available to you on the toolbar.

To use the Style listbox, select the cells to which you want to apply a style and then select the desired style from the Style listbox that you added to the toolbar.

Категории