If you find yourself applying the same formatting options repeatedly, you could probably save a lot of time by using a style. A style is a collection of formats—such as font size, color, patterns, and alignment—that you can define and save as a group. Once you have defined and saved a style, you can apply all of the formatting elements at once.
A style can contain any (or all) of the following formatting attributes: • Number
• Font (type, size, and color) • Borders
• Alignment • Pattern
• Protection (locked and hidden)
In this lesson, you will learn how to create, apply, and modify a style. The easiest way to create a style is by example. This means you have to format a cell or cell range and then create a style based on that cell or cell range.
1
1..
If necessary, open the workbook named Lesson 3D and save it asExpense Report.
If you do not know where your practice files are located, ask your instructor for assistance.
Figure 3-24
The Style dialog box.
Figure 3-25
The Expense Report worksheet with the Money Style applied. Figure 3-25 Figure 3-24 Select which formatting elements you want to include in the style
Modify the selected style Select a style to apply the style to the selected cells or redefine a style's formats
Chapter Three: Formatting a Worksheet
119
Quick Reference
To Create a Style by Example:
1. Select a cell or cell range
and apply the formatting you want to use in the style.
2. Make sure the cell or cell
range you formatted in Step 1 is selected, then select Format → Style
from the menu.
3. Enter a name for the style
in the Style name box.
4. (Optional) Remove the
checkmarks for any formatting attributes that you don’t want to be part of the style.
5. Click OK.
To Apply a Style:
1. Select a cell or cell range
you want to format.
2. Select Format → Style
from the menu, select the style from the Style list and click OK.
To Modify a Style: 1. Select Format → Style
from the menu, select the style you want to modify from the Style list and click Modify.
2. Modify any of the styles
formatting attributes and click OK when you’re finished.
2
2.
Select the cell range D5:D17 and select Format → Cells from the menu.The Format Cells dialog box appears. Specify how you want to format the selected cell range.
3
3.
Click the Number tab, select Currency from the Category list, and select the first option, -$1,234.00, from the Negative numbers list.The next formatting option you want to change is the font formatting.
4
4..
Click the Font tab, select Times New Roman from the Font list, select Regular from the Font style list, click the Font color list arrow and select the Blue color.The last formatting option you want to change is the pattern.
5
5.
Click the Patterns tab, select No Color, and then click OK.The Format Cells dialog box closes and the formatting options you specified are applied to the selected cell range.
Instead of applying the same formatting options to other cells by repeating steps 2-4, you can create a Style based on the cells you just formatted.
6
6.
Verify the cell range D5:D17 is selected and select Format → Style from the menu.The Style dialog box appears, as shown in Figure 3-24. Here you can create, define, or apply a style. You want to create a new style named Money based on the selected cell range.
7
7..
Type Money in the Style name text box and click OK.You’ve just created a new Style named money. Try applying the Money style to a new cell range in the worksheet.
8
8..
Select the cell range G5:G17, select Format → Style from the menu, select Money from the Style name list and click OK.The dialog box closes and the selected cell range is formatted with the Money style, as shown in Figure 3-25. See how quickly and easily you can apply cell formatting to using styles?
Now that you know how to create and apply styles, we can move on to what’s really neat about styles: modifying them. You can modify the formatting options for a style just like you would modify the formatting for a cell or cell range. However, when you modify a style, every cell formatted with that style is updated to reflect the formatting
changes. Here is how to modify a style:
9
9..
Select Format → Style from the menu, select Money from the Style list and click Modify.The Format Cells dialog box appears.
1
10..
Click the Font tab, select Arial from the Font list. Click OK to close the Format cells dialog box, then click OK again to close the Style dialog box.The dialog box closes and every cell formatted with the Money style is updated to reflect the change in fonts.
You can delete the Money style, since you will no longer be using it.
1
111..
Select Format → Style from the menu, select Money from the Style list and click Delete.Excel deletes the Money style.
Look how much time you just saved by modifying the Money style. If you hadn’t used a style, you would have had to go and change the font formatting manually. Plus, there is always the chance that you might miss reformatting something.