John_356
New Member
- Joined
- Jan 17, 2021
- Messages
- 26
- Office Version
- 365
- Platform
- Windows
Good day,
Been trying to figure out a solution to filter my pivot table based on a cell value; that cell is on another worksheet used as dashboard and the whole story is about automating reportings.
Location of reference cell:
Primary objective: Below numbers from 1 to 12 are Months and I'm looking for an elegant if solution to link them to above reference.
Secondary objective: If the reference is blank then all Months should be selected.
Current filtering is off for all Months:
Many thanks in advance to whomever will get this one!
Cheers
J
Been trying to figure out a solution to filter my pivot table based on a cell value; that cell is on another worksheet used as dashboard and the whole story is about automating reportings.
Location of reference cell:
VBA Code:
Worksheets("S").Range("J14")
Primary objective: Below numbers from 1 to 12 are Months and I'm looking for an elegant if solution to link them to above reference.
Secondary objective: If the reference is blank then all Months should be selected.
Current filtering is off for all Months:
VBA Code:
With Worksheets("PivotTable").PivotTables("SalesPivotTable").PivotFields("Month")
.PivotItems("1").Visible = False
.PivotItems("2").Visible = False
.PivotItems("3").Visible = False
.PivotItems("4").Visible = False
.PivotItems("5").Visible = False
.PivotItems("6").Visible = False
.PivotItems("7").Visible = False
.PivotItems("8").Visible = False
.PivotItems("9").Visible = False
.PivotItems("10").Visible = False
.PivotItems("11").Visible = False
.PivotItems("12").Visible = False
Many thanks in advance to whomever will get this one!
Cheers
J