SpecialCells Method

This content is no longer actively maintained. It is provided as is, for anyone who may still be using these technologies, with no warranties or claims of accuracy with regard to the most recent product version or service release.

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

expression.SpecialCells(Type, Value)

expression   Required. An expression that returns one of the objects in the Applies To list.

XlCellType

XlCellType can be one of these XlCellType constants.
xlCellTypeAllFormatConditions.  Cells of any format
xlCellTypeAllValidation. Cells having validation criteria
xlCellTypeBlanks. Empty cells
xlCellTypeComments. Cells containing notes
xlCellTypeConstants. Cells containing constants
xlCellTypeFormulas. Cells containing formulas
xlCellTypeLastCell. The last cell in the used range
xlCellTypeSameFormatConditions.  Cells having the same format
xlCellTypeSameValidation.  Cells having the same validation criteria
xlCellTypeVisible. All visible cells

XlSpecialCellsValue

XlSpecialCellsValue can be one of these XlSpecialCellsValue constants.
xlErrors
xlLogical
xlNumbers

xlTextValues

Example

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

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