SpecialCells Method

Applies To

Range Object.

Description

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

Syntax

object.SpecialCells(type, value)

object

Required. The Range object.

type

Required. The types of cells to include, as shown in the following table.

Value

Meaning

xlNotes

Cells containing notes.

xlConstants

Cells containing constants.

xlFormulas

Cells containing formulas.

xlBlanks

Empty cells.

xlLastCell

Last cell of the used range.

xlVisible

All visible cells.


value

Optional. If type is xlConstants or xlFormulas, the value argument is used to determine which types of cells to include in the result. These values may be added together to return more than one type. The default is to select all constants or formulas, no matter what the type.

Value

Meaning

xlNumbers

Numbers

xlTextValues

Text

xlLogical

Logical values

xlErrors

Error values


Example

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


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