PivotTable filter not running and failing to apply

38 Views Asked by At

I have a table which i have created from Power Pivot.

Im trying to apply a filter to the pivottable however it is constantly coming up with this error: Error

its driving me crazy as it seems so simple yet wont work no matter what i try.

Everything online states this should work... Yet it doesnt at all.

    ThisWorkbook.Sheets("DATA").PivotTables("VQ_Table").PivotFields( _
        "[VQ_Table].[TM Name].[TM Name]").VisibleItemsList = Array("TM Name Here")

Please can someone advise? Thanks in advance.

1

There are 1 best solutions below

8
Eugene Astafiev On

Make sure that a specified pivot fields object exists.

Set pvtTable = Worksheets("Sheet2").Range("A1").PivotTable 
rw = 0 
For Each pvtField In pvtTable.PivotFields 
 rw = rw + 1 
 nwSheet.Cells(rw, 1).Value = pvtField.Name 
Next pvtField

Try to iterate over all pivot fields and write down their names.