Muokkaa

Jaa


Range.SpecialCells method (Excel)

Returns a Range object that represents all the cells that match the specified type and value.

Syntax

expression.SpecialCells (Type, Value)

expression A variable that represents a Range object.

Parameters

Name Required/Optional Data type Description
Type Required XlCellType The cells to include.
Value Optional Variant If Type is either xlCellTypeConstants or xlCellTypeFormulas, this argument is used to determine which types of cells to include in the result. These values can be added together to return more than one type. The default is to select all constants or formulas, no matter what the type.

Return value

Range

Remarks

Use the XlSpecialCellsValue enumeration to specify cells with a particular type of value to include in the result.

Example

This example selects the last cell in the used range of Sheet1.

Worksheets("Sheet1").Activate 
ActiveSheet.Cells.SpecialCells(xlCellTypeLastCell).Activate

Support and feedback

Have questions or feedback about Office VBA or this documentation? Please see Office VBA support and feedback for guidance about the ways you can receive support and provide feedback.