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
ib11
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