(Solved) – Change pivot filter with combobox


I´m trying to filter my pivot table from a combobox.
I have the VBA code:

Sub DropDown2_Change()

On Error Resume Next

Sheets("TABLES").PivotTables("PivotTable1").PivotFields("Planned Maintanence").ClearAllFilters
Sheets("TABLES").PivotTables("PivotTable1").PivotFields("Planned Maintanence").CurrentPage = Sheets("TABLES").Range("E126").Value

End Sub

But when I use the combobox it doesn’t copy the value to the “filter” cell.
It copys the value to D126, and then I index it to E126. but then the VBA should connect the pivot filter on C126. **edit note* the combobox is in another sheet.*

See attachments
enter image description here

Leave a Reply

Your email address will not be published. Required fields are marked *