PivotTable.ChangePivotCache method (Excel)
Changes the PivotCache object of the specified PivotTable.
Syntax
expression.ChangePivotCache (bstr)
expression A variable that represents a PivotTable object.
Parameters
Name | Required/Optional | Data type | Description |
---|---|---|---|
bstr | Required | String | A PivotTable or PivotCache object that represents the new PivotCache for the specified PivotTable. |
Remarks
The ChangePivotCache method can only be used with a PivotTable that uses data stored on a worksheet as its data source. A run-time error occurs if the ChangePivotCache method is used with a PivotTable that is connected to an external data source.
Example
In the following code sample, the pivot table named PivotTable1 is on Sheet1. The code changes its pivot cache to a cache created from the data stored in the table called Table2 in the same workbook.
Sheets("Sheet1").PivotTables("PivotTable1").ChangePivotCache _
ActiveWorkbook.PivotCaches.Create(SourceType:=xlDatabase, SourceData:="Table2", Version:=xlPivotTableVersion15)
Support and feedback
Have questions or feedback about Office VBA or this documentation? Please see Office VBA support and feedback for guidance about the ways you can receive support and provide feedback.
피드백
https://aka.ms/ContentUserFeedback
출시 예정: 2024년 내내 콘텐츠에 대한 피드백 메커니즘으로 GitHub 문제를 단계적으로 폐지하고 이를 새로운 피드백 시스템으로 바꿀 예정입니다. 자세한 내용은 다음을 참조하세요.다음에 대한 사용자 의견 제출 및 보기