Run Time Error 1004 'Unable to get the PivotFields property of the PivotTable class'

流过昼夜 提交于 2019-12-05 20:20:34

问题


I realy have no Idea what this error means... I am trying to use the code to select all the rows under one of the subheaders in a pivot table. I am getting a run time error 1004 "unable to get the PivotFields property of the Pivot Table class". Here is the code:

 Sub ttest()
 Dim pt As PivotTable
 Set pt = Sheets("Report").PivotTables("PivotTable1")

 pt.PivotFields("Row Labels").PivotItems("CL").DataRange.Select

 End Sub

回答1:


As JosieP said in the comments, the 1004 error means that there is no such object, that is there is no such pivot field that is called "Row Labels".



来源:https://stackoverflow.com/questions/17429746/run-time-error-1004-unable-to-get-the-pivotfields-property-of-the-pivottable-cl

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!