Microsoft Office Tutorials and References
In Depth Information
19.3.46 SpecialCells Method
will swap the contents of these two cells, but the code:
Range("A1:A2").Sort Key1:=Cells(1, 1), MatchCase:=False
will not.
The optional Orientation parameter determines whether the sort is done by row or by column.
It can assume either of the values in the following enum:
Enum XlSortOrientation
xlSortColumns = 1
xlSortRows = 2
End Enum
For instance:
Range("A1:B2").Sort Key1:=Rows(1), Orientation:=xlSortColumns
sorts the columns in the range A1:B2 using the first row for the sort key.
The rest of the parameters are not used in the U.S. English version of Excel. The SortMethod
parameter is not documented, but it has a default value xlPinYin , whatever that means.
19.3.46 SpecialCells Method
This method returns a Range object that represents all the cells that match a specified type and
value. The syntax is:
RangeObject .SpecialCells( Type , Value )
The Type parameter specifies the type of cells to include from RangeObject . It can be one of
the following XlCellType constants:
Enum XlCellType
xlCellTypeComments = -4144 'Cells with comments
xlCellTypeFormulas = -4123 'Cells with formulas
xlCellTypeConstants = 2 'Cells with constants
xlCellTypeBlanks = 4 'Blank cells
xlCellTypeLastCell = 11 'Last cell in range
xlCellTypeVisible = 12 'All visible cells
End Enum
For instance, the code:
Range("A1:D10").SpecialCells(xlCellTypeBlanks).Select
selects all blank cells in the range A1:D10.
The optional Value parameter applies when the Type parameter is either
xlCellTypeConstants or xlCellTypeFormulas and identifies more specifically the type
of cell to return. In these cases, the Value parameter can be set to one of, or a sum of, the
following constants:
Enum XlSpecialCellsValue
xlNumbers = 1
Search JabSto ::




Custom Search