Dear MrExcel users,
I have a pivot table that extracts data from ms sql database and afterthat, I filter the data with VBA according to some criteria.
Sometimes, the filter gives a run-time error '1004' because a criteria doesn't have any data to display. So I wondered, is there a solution when a situation like this occurs?
VBA code is simple, generated when recording a macro:
Thank you for your help.
I have a pivot table that extracts data from ms sql database and afterthat, I filter the data with VBA according to some criteria.
Sometimes, the filter gives a run-time error '1004' because a criteria doesn't have any data to display. So I wondered, is there a solution when a situation like this occurs?
VBA code is simple, generated when recording a macro:
VBA Code:
Sheets("raport").PivotTables("PivotTable1").PivotFields("Denumire_gestiune").ClearAllFilters
With Sheets("raport").PivotTables("PivotTable1").PivotFields("Denumire_gestiune")
.PivotItems("NG 643-2").Visible = True
End With
Thank you for your help.