Page 210 - Excel Progamming Weekend Crash Course
P. 210

k540629 ch14.qxd  9/2/03  9:34 AM  Page 185




                  Session 14 — Formatting a Worksheet                                    185


               Table 14-6  Information Returned by Properties Related to Row Height

               Property       For single-row ranges        For multirow ranges
               RowHeight      The height of the row        If all rows are the same height, the
                                                           height of one row; if all rows are not the
                                                           same height, Null
               Height         The height of the row        The total height of all rows in the range

                  The following code changes the row height of a range. If the rows in the range are all the
               same height, the height is doubled. If they are not all the same height, they are all set to
               22 points.

                  If SomeRange.RowHeight > 0 Then
                      SomeRange.RowHeight = SomeRange.RowHeight * 2
                  Else
                      SomeRange.RowHeight = 22
                  End If



                                                  REVIEW
               This session explained the most important aspects of formatting an Excel worksheet.

                   Numbers can be displayed in a wide variety of formats, appropriate for the data
                   being displayed.
                   Data can be displayed in different fonts. The size, color, and style of the font can be
                   changed, too.
                   Cell data can be displayed at any orientation from horizontal to vertical.
                   You have full flexibility for displaying single or double borders around individual
                   cells or multiple cell ranges.
                   Row height and column width can be changed to fit the data contained in the
                   worksheet.



                                               QUIZ YOURSELF
                 1. When defining a numeric format, what’s the different between the # and 0 charac-
                    ters? (See the “Number Formatting” section.)
                 2. If you increase the size of the font in a range, do you also need to increase the row
                    height to fit the font? Explain. (See the “Changing Row and Column Size” section.)
                 3. How do you set the width of a column to fit the widest data that the column con-
                    tains? (See the “Changing Row and Column Size” section.)
                 4. When dealing with fonts, what is a point? (See the “Font Formatting” section.)
                 5. How do you define a color in VBA? (See the “Font Formatting” section.)
   205   206   207   208   209   210   211   212   213   214   215