Hello All,
I want to filter the Row Label (which are my weeks of the year) for two selected weeks.
The value of the weeks are from two (non-contiguous) cells on the active sheet ("Sheet4") and my pivot table is located in another sheet named "Block 18".
I manage to filter for one selected week, but I can't seem to filter with more than one selection of a week.
I tried using AND to select another value, but it did not work. I also tried to assign another value with
But only the first value was selected.
Can someone please assist me?
I have only been trying my hand at VBA since beginning of October.
Friendly Regards
Herman
I want to filter the Row Label (which are my weeks of the year) for two selected weeks.
The value of the weeks are from two (non-contiguous) cells on the active sheet ("Sheet4") and my pivot table is located in another sheet named "Block 18".
I manage to filter for one selected week, but I can't seem to filter with more than one selection of a week.
Code:
Application.ScreenUpdating = False
Sheets("Block 18").PivotTables("PivotTable2").ManualUpdate = True
Sheets("Block 18").PivotTables("PivotTable2").PivotFields("WEEK").ClearAllFilters
Sheets("Block 18").PivotTables("PivotTable2").PivotFields("WEEK").PivotFilters. _
Add Type:=xlCaptionEquals, Value1:=Range("R20") [U]And[/U] Range("T20")
Sheets("Block 18").PivotTables("PivotTable2").ManualUpdate = False
Sheets("Sheet4").Select
Application.ScreenUpdating = True
I tried using AND to select another value, but it did not work. I also tried to assign another value with
Rich (BB code):
Value2:=Range("T20")
Can someone please assist me?
I have only been trying my hand at VBA since beginning of October.
Friendly Regards
Herman