Export (0) Print
Expand All

Range.SpecialCells Method

Office 2007
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

NameRequired/OptionalData TypeDescription
TypeRequiredXlCellTypeThe cells to include.
ValueOptionalVariantIf 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

XlCellType constantsValue
xlCellTypeAllFormatConditions. Cells of any format-4172
xlCellTypeAllValidation. Cells having validation criteria-4174
xlCellTypeBlanks. Empty cells4
xlCellTypeComments. Cells containing notes-4144
xlCellTypeConstants. Cells containing constants2
xlCellTypeFormulas. Cells containing formulas-4123
xlCellTypeLastCell. The last cell in the used range11
xlCellTypeSameFormatConditions. Cells having the same format-4173
xlCellTypeSameValidation. Cells having the same validation criteria-4175
xlCellTypeVisible. All visible cells12
XlSpecialCellsValue constantsValue
xlErrors16
xlLogical4
xlNumbers 1
xlTextValues2

Example

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

Visual Basic for Applications
Worksheets("Sheet1").Activate
ActiveSheet.Cells.SpecialCells(xlCellTypeLastCell).Activate



Community Additions

ADD
Show:
© 2014 Microsoft