Hi Mr Excel Community,
Please note I have a report and already have a macro that user be able to select multiple options in dropdown (Data Validation List) (Range C4) but now I need that everytime C4 changed the pivot table be updated with the values according the cell. I already have the code to do it when the cell value C4 has one item but now I have multiples separate from Comma.
This code works for individual values.
But I need the pivot table be filtered when Cell C4 as example: 300, 400, 500 (It can be any number and no limit of values) so the pivot table can show data related with those values separated with the comma.
Appreciate any idea!
Regards
Andres
Please note I have a report and already have a macro that user be able to select multiple options in dropdown (Data Validation List) (Range C4) but now I need that everytime C4 changed the pivot table be updated with the values according the cell. I already have the code to do it when the cell value C4 has one item but now I have multiples separate from Comma.
This code works for individual values.
VBA Code:
If Target.Address = Range("C4").Address And Range("C4").Value <> Empty Then
ActiveSheet.PivotTables("TablePi").PivotFields("CoCd").ClearAllFilters
ActiveSheet.PivotTables("TablePi").PivotFields("CoCd").PivotFilters.Add Type:=xlCaptionEquals, Value1:=Range("C4").Value
End If
But I need the pivot table be filtered when Cell C4 as example: 300, 400, 500 (It can be any number and no limit of values) so the pivot table can show data related with those values separated with the comma.
Appreciate any idea!
Regards
Andres