Styles in Excel
Applying styles
There are two methods to apply a style to a cell.
The first one is by using the menu: "Format", "Style…". Select the style you need from the dropdown list and click OK. Or in Excel 2007: Home tab, Styles group, Expand the Cell Styles gallery and click a style.
In Excel 97-2003 you can save yourself some time (in future) by adding the Style dropdown to a toolbar, like this:
TIP: Adding the style dropdown to a toolbar.
- Rightclick any toolbar or menu and select "Customize...". The dialog screen shown below will appear (after you click the "Commands" tab):
- Below "Categories", click the item called "Format". Now drag the Style dropdown to one of your toolbars (see below)
Dragging the Style control to a toolbar and let go.
Applying a style to some cells now takes nothing more than picking the right one from your new style dropdown. If the format of any of the selected cells deviates from the selected style then Excel (Excel 97 - 2003) will ask you whether or not to update the style to match the formatting of the selected cells (Excel 2007 does not ask you this question!):

Confirm to Excel how it must apply the style
This dialog needs some explaining to understand what happens when you click a button.
-
When you click Yes:
Excel will check all selected cells and add only those elements to the style which coincide for all cells. So if you for example changed a font characteristic for one cell, then Excel will remove the Font settings from the style. Of course you can go back to the style using the menu (format, styles) and modify the style to include that setting again. Note however, that the one cell you changed a font thing to will remain being different from the others.
-
If you click No:
The selected style will be applied to all cells. Any formatting in those cells will be replaced with the selected formatting elements if the style you chose. Any deviations from a style will be removed. This is the choice Excel 2007 makes for you if you select a style from the styles gallery.






Comments
All comments about this page:
Comment by: Alan Hutchins (2/6/2009 6:16:48 AM)I added a Style in the way that you suggested (Excel 2003), and then added the control to one of the toolbars. The newly created style is available for selection in the workbook from which it is created, but it is NOT available in any other workbook. Have I misunderstood something?
I was hoping that I could use this to create a few specific styles that would be available for me to select in any workbook.
Comment by: Jan Karel Pieterse (2/6/2009 6:59:33 AM)Hi Alan,
You have uncovered a small omission in the article. Styles are part of a workbook, not stored anywhere else.
So if you create a style, it stays with the workbook.
You can however copy a style from one workbook to another by simply copying a cell with that style to the other file.
Also, there is a Merge button on the style dialog that lets you merge the styles from another workbook into the one you have in front of you.
Comment by: John Pittman (6/3/2009 4:38:33 PM)Maybe I missed something but at the heading of this page you mention that "There are two methods to apply a style to a cell"
I would like to dynamically add "Good", Neutral", or "Bad" Styles to cells in a spreadsheet.
I can manage getting the content in cells to change, but would like to change the style as well.
Am I right in suggesting that this is not the second method?
Comment by: Jan Karel Pieterse (6/3/2009 11:40:59 PM)Hi John,
The text on this page isn't very clear on what the second method is. In fact I meant to write that the second method is by using the styles dropdown, which you can add to a toolbar.
I'm not sure if you can use conditional formatting to change the style in Excel 2007. If not, then I would just use a conditional format for your three situations and manually set up their formatting.
Comment by: Chris Ainley (10/23/2009 6:22:08 PM)Just above, you mentioned that things within the Cell Styles dropdown can be added to a toolbar. I assume that there's a way of making the 'good', 'bad' icons available on a toolbar, making them more accessible for interactive tagging of cells.
How does one get the Good, Bad, Neutral, etc designation icons onto the toolbar (so that I don't have to keep using the dropdown)?
Thanks,
Chris
Comment by: Jan Karel Pieterse (10/24/2009 1:08:30 AM)Hi Chris,
I'm afraid you can't add a specific style button to the QAT. But you can create small macros and add macro buttons to the QAT for this purpose.
For example:
Selection.Style = "Bad"
ENd Sub
Have a question, comment or suggestion? Then please use this form.
If your question is not directly related to this web page, but rather a more general "How do I do this" Excel question, then I advise you to ask your question here: www.eileenslounge.com.