I have a combo box that is linked to a list of dates. I have numerous getpivotdata commands that are based on the date that is selected in the combo box. I have 20 or so pivot tables that I want to filter to the date selected in the combo box. Sometimes, there is no data in one of the pivot tables for that date, so I want the pivot table to select no fields and the getpivotdata to return zero, not just skip it because then it leaves the pivot table with no filters and returns the wrong number in the getpivotdata command.
CurrentDateCode is the link to the combo box, Control!J and K are my sheets and pivot tables.
For i = 5 To 30 Sheets(Range("Control!J" & i).Value).PivotTables(Range("Control!K" & i).Value).PivotFields("FILE_DATE").ClearAllFilters
Sheets(Range("Control!J" & i).Value).PivotTables(Range("Control!K" & i).Value).PivotFields("FILE_DATE").CurrentPage = Range("CurrentDateCode").Value
Next i
CurrentDateCode is the link to the combo box, Control!J and K are my sheets and pivot tables.
For i = 5 To 30 Sheets(Range("Control!J" & i).Value).PivotTables(Range("Control!K" & i).Value).PivotFields("FILE_DATE").ClearAllFilters
Sheets(Range("Control!J" & i).Value).PivotTables(Range("Control!K" & i).Value).PivotFields("FILE_DATE").CurrentPage = Range("CurrentDateCode").Value
Next i