hi, I am trying to find code that will select certain dates in a pivot table dropdown after it has been refreshed. The dropdown will have boxes for dates and the code should select all the months after today's date or between certain dates. thx. Using the macro recorder I have the following, but the dates are hard coded and I need it to be flexible. thx.
Code:
Sub MacRecord()
ActiveSheet.PivotTables("PivotTable1").PivotFields("need by").CurrentPage = _
"(All)"
With ActiveSheet.PivotTables("PivotTable1").PivotFields("need by")
.PivotItems("9/1/2017").Visible = True
.PivotItems("10/1/2017").Visible = True
.PivotItems("11/1/2017").Visible = True
.PivotItems("12/1/2017").Visible = True
End With
End Sub