Skip to main content

Range.SpecialCells method

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


expression.SpecialCells (Type, Value)

expression A variable that represents a Range object.


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



Use the XlSpecialCellsValue enumeration to specify cells with a particular type of value to include in the result. The XlSpecialCellsValue enumeration can be added together to return more than one type.

The following examples select all cells that contain constants in entire sheet.

Cells.SpecialCells(xlCellTypeConstants, 23).Select

23 = 16 (xlErrors) + 4 (xlLogical) + 1 (xlNumbers) + 2 (xlTextValues)


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


Leave a comment

Your email address will not be published. Required fields are marked *

Format your code: <pre><code class="language-vba">place your code here</code></pre>