I am trying to filter data when the user double clicks a cell of a pivot table range in sheet "Pivot" then that field should gets filtered from "SalesData" Sheet. I know how to filter data only from one column.
But here the problem is that we don't know what user wants. He/she can double click on Region/Manager/SalesMan/Item etc. Based on their double click in "Pivot" sheet the same data should be filtered from "SalesData" Sheet.
Example: When the user double clicks on "Timothy", then this filed should be filtered from "Manager" (Column C) or when the user double clicks on "Television" then this field should be filtered from "Item" (Column E) etc. I am using the hierarchy in the pivot table and users can double click on any item from Column A of the entire pivot table range.
I know how to filter using simple VBA as shown below, however it would be great if solution is possible for the problem mentioned above.
Sub FilterRows()
With Worksheets("SalesData").Range("A1")
.AutoFilter field:=2, Criteria1:="East"
.AutoFilter field:=4, Criteria1:="Luis"
End With
End Sub