Microsoft Office Tutorials and References
In Depth Information
19.3.9 Calculate Method
The optional ColorIndex parameter specifies the border color, either as an index into the current
color palette or as one of the following XlColorIndex constants:
Enum XlColorIndex
xlColorIndexNone = -4142
xlColorIndexAutomatic = -4105
End Enum
The optional Color parameter also specifies the border color as an RGB value. Note that you
should specify at most one of the color parameters.
The technique for clearing a border is a bit unexpected. For instance, suppose we have set a border
with:
rng.BorderAround LineStyle:=xlDash
To clear this border, we might naturally try:
rng.BorderAround LineStyle:=xlLineStyleNone
but this does nothing. Instead, we must write:
rng.Borders.LineStyle = xlLineStyleNone
which clears the borders around each cell in the range separately.
19.3.9 Calculate Method
This method (which also applies to the Workbook and Worksheet objects) calculates all cells in
the specified range. For instance, the code:
Worksheets(1).Rows(2).Calculate
will calculate all of the cells in the second row of the first worksheet.
19.3.10 Clear Methods
Excel has several clear methods. In particular, the Clear method clears all contents, formulas, and
formatting from the cells in the given range. The ClearContents method clears only the contents
(values and/or formulas) from the cells in the range and leaves the formatting intact. The
ClearFormats method clears only the formatting from the cells in the range.
19.3.11 ColumnDifferences and RowDifferences Methods
The ColumnDifferences method returns a Range object that represents all the cells in the range
whose contents are different from certain comparison cells (there is one comparison cell in each
column). The syntax is:
RangeObject .ColumnDifferences( ComparisonCell )
where ComparisonCell is a range object that represents a single cell. The purpose of
ComparisonCell is simply to identify the row whose cells contain the comparison values.
To illustrate, consider the following code, whose results are shown in Figure 19-6 :
Search JabSto ::

Custom Search