ClearTable 方法 (Excel)PivotTable.ClearTable method (Excel)

ClearTable 方法用于清除数据透视表。The ClearTable method is used for clearing a PivotTable. 清除数据透视表包括删除所有字段以及删除应用于数据透视表的所有筛选和排序。Clearing PivotTables includes removing all the fields and deleting all filtering and sorting applied to the PivotTables. 此方法将数据透视表重置为该表刚创建而尚未添加任何字段时的状态。This method resets the PivotTable to the state it had right after it was created, before any fields were added to it.

语法Syntax

表达式ClearTableexpression.ClearTable

_表达式_一个代表**PivotTable** 对象的变量。expression A variable that represents a PivotTable object.

注解Remarks

ClearTable 函数不使用任何参数,可用于关系数据透视表和 OLAP 数据透视表。The ClearTable function takes no arguments and is available for both relational and OLAP PivotTables.

示例Example

以下示例清除活动工作表中的数据透视表。The following example clears a PivotTable on the active worksheet.

ActiveSheet.PivotTables(1).ClearTable()

支持和反馈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.