I am coding in excel 2007 vba to create a pivot table based on data on the tab. Although my code is more complicated than the code below, I believe I have narrowed my problem down to the fact that whenever I attempt to filter a single character value I encounter a Run-time error '1004': Unable to get the PivotItems property of the PivotField class.
As an example I ran the following code which worked:
ActiveSheet.PivotTables("Tentatives_Summary_PivotTable").PivotFields("FAMILY").PivotItems("(blank)").Visible = False
ActiveSheet.PivotTables("Tentatives_Summary_PivotTable").PivotFields("FAMILY").PivotItems("Test").Visible = False
'this works
However, when filtering for "J" I encounter the run-time error '1004':
ActiveSheet.PivotTables("Tentatives_Summary_PivotTable").PivotFields("FAMILY").PivotItems("J").Visible = False
'this does not work
Bookmarks