Range.SpecialCells 方法 (Excel)Range.SpecialCells method (Excel)

返回一个Range对象, 该对象代表与指定类型和值匹配的所有单元格。Returns a Range object that represents all the cells that match the specified type and value.


表达式Range.specialcells(Type, Value)expression.SpecialCells (Type, Value)

expression 一个表示 Range 对象的变量。expression A variable that represents a Range object.


名称Name 必需/可选Required/Optional 数据类型Data type 说明Description
TypeType 必需Required XlCellTypeXlCellType 要包含的单元格。The cells to include.
ValueValue 可选Optional VariantVariant 如果_Type_为xlCellTypeConstantsxlCellTypeFormulas, 则此参数用于确定要在结果中包含哪些类型的单元格。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



使用**XlSpecialCellsValue** 枚举指定要在结果中包含的特定类型的值的单元格。Use the XlSpecialCellsValue enumeration to specify cells with a particular type of value to include in the result.


本示例选定工作表 Sheet1 中已用区域的最后一个单元格。This example selects the last cell in the used range of Sheet1.


支持和反馈Support and feedback

有关于 Office VBA 或本文档的疑问或反馈?Have questions or feedback about Office VBA or this documentation? 请参阅 Office VBA 支持和反馈,获取有关如何接收支持和提供反馈的指南。Please see Office VBA support and feedback for guidance about the ways you can receive support and provide feedback.