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

Formatting Excel Objects

                             Figure 10-1 shows two worksheets with sheet tabs that were changed using the
                             Worksheet_Change event procedure. The worksheet on the left is active, so Excel displays
                             a line of the tab’s color below the worksheet name, but notice that Excel displays the
                             worksheet’s name in black type on a white background so that the name can be read easily.
                             The inactive sheet to the right displays the tab with a full blue background and black text,
                             indicating it was also changed.



























                                                                                                             Chapter 10
                             Figure 10-1.  The active sheet’s name is displayed with a view to readability, whereas
                             inactive sheet tabs let the tab’s color take precedence.


                             Important  You need to be sure to put the code for a worksheet event, such as
                             Worksheet_Change, in the code module associated with the worksheet you want to monitor.


                    Formatting Fonts

                             When you program Excel using VBA, it can be easy to forget that the most important part of
                             your worksheet is the data. The easier your data is to understand, the more effective your pre­
                             sentation will be. Figure 10-2 on page 234 offers a somewhat extreme example of the differ­
                             ence between a well-formatted worksheet and a worksheet with no distinction between
                             headings and data.
                             Most Excel users learn how to use the controls on the Formatting toolbar and in the Format
                             Cells dialog box very early in their Excel careers. In a similar vein, you should make the Font
                             object part of your basic VBA repertoire. Table 10-6 lists and describes the properties of the
                             Font object.


                                                                                                       231
                                                                                                Part 4:  Advanced VBA
   252   253   254   255   256   257   258   259   260   261   262