Page 245 - Microsoft Office Excel 2003 Programming Inside Out
P. 245

Chapter 10


                    Formatting Excel Objects




                             Using Excel Color Constants and the    Formatting Fonts . . . . . . . . . . . . . . . . . . 231
                             Color Palette . . . . . . . . . . . . . . . . . . . . .  219   Formatting Cells. . . . . . . . . . . . . . . . . . . 233
                             Formatting Worksheet Elements  . . . . .  230   Formatting Borders  . . . . . . . . . . . . . . . . 236



                             If left in their original condition, Microsoft Excel worksheets are fairly plain to look at. Black
                             text on a white background, with gray gridlines indicating cell barriers, is a functional way to
                             present data, but it’s not the most exciting presentation imaginable. Not to mention the fact
                             that if all of your data looks the same, there’s nothing to distinguish one cell from another
                             except for the value. And, yes, the values are the most important part of a worksheet, but
                             presentation does count for something.
                             In this chapter you’ll learn how to use Excel color constants and the Excel color palette,
                             modify the existing color palette, find out how to get around the 56-color limit in Excel, and
                             format cells by changing their interior, font, and border colors.

                    Using Excel Color Constants and the Color Palette

                             Although there are a lot of ways you can reformat the elements of a worksheet, one great way
                             to call attention to an element is by changing that element’s color. Whether you change the
                             color of text in a cell to reflect the cell’s value, change the color of a sheet tab to indicate there
                             was a change made to the worksheet’s data, or make a cell’s background yellow to emphasize
                             that it is the active cell, you can use colors to make your data stand out and your sheets easier
                             to use.
                             The simplest way to assign a color to a worksheet element is to use one of the Microsoft
                             Visual Basic for Applications color constants, which represent the eight basic colors available
                             on a computer. The constants and the colors they represent are listed in Table 10-1.
                             Table 10-1.  The RGB Values of the VBA Color Constants

                             Constant           Description       Constant          Description
                             vbBlack            Black             vbRed             Red
                             vbGreen            Green             vbYellow          Yellow
                             vbBlue             Blue              vbMagenta         Magenta
                             vbCyan             Cyan              vbWhite           White






                                                                                                       219
                                                                                                Part 4:  Advanced VBA
   240   241   242   243   244   245   246   247   248   249   250