Microsoft Office Tutorials and References
In Depth Information
Figure 19-6. The result of the ColumnDifferences method
Dim rng As Range, rng2 As Range
Set rng = Range("A1:D6")
Set rng2 = _
rng.ColumnDifferences(Comparison:=Range("A1"))
rng2.Select
Figure 19-6. The result of the ColumnDifferences method
Since the ComparisonCell is cell A1, the first cell of each column in the range contains the
comparison value. Thus, the cells that do not contain an "x" are selected in column A, the
nonblank cells are selected in column B, the cells that do not contain a "y" are selected in column
C and the cells that do not contain an "a" are selected in column D.
The RowDifferences method is the analog for rows of the ColumnDifferences method.
19.3.12 ColumnWidth and RowHeight Properties
The ColumnWidth property returns or sets the width of the columns in the specified range.
The return value is in units, each of which equals the width of one character in the Normal style.
For proportional fonts, the width of the character "0" (zero) is used.
Note that if the columns in the range do not all have the same width, the ColumnWidth property
returns Null .
The RowHeight property returns the height of all the rows in the range, measured in points. Note
that if the rows in the range do not all have the same height, the RowHeight property returns Null .
19.3.13 Width, Height, Top, and Left Properties
These properties return values for the entire range, in points. For instance, the Top property
returns the distance, in points, from the top of row 1 to the top of the first (leftmost) area of the
range.
Note that when applied to a column, the Width property returns the width, in points, of the column.
However, the relationship between Width and ColumnWidth can seem a bit strange at first.
For instance, the following code shows that a column of ColumnWidth 1 has Width 9.6 but a
column of ColumnWidth 2 has Width 15. (In my case, the Normal style is 10 point Arial.)
However, if the ColumnWidth property really measures the width of a column in units and the
Width property really measures the width of the same column in points, then doubling one of
these properties should double the other!
Columns("A").ColumnWidth = 1
MsgBox Columns("A").Width ' Displays 9.6

Search JabSto ::

Custom Search