Hello.

I am wondering how to write VBA where:

1)User puts start date and end date
2) with the start/end date, it changes the jobdate in pivot table
3)refreshes the pivot table

The code I currently have for #2 and 3 is below:

Sub TestRun()
'This is where I would want the Input Box code.
InputBox = xxxxxxxxxxx


'Changes Pivot Table Date
ActiveSheet.PivotTables("PivotTable3").PivotFields("JobDate").ClearAllFilters
ActiveSheet.PivotTables("PivotTable3").PivotFields("Years").ClearAllFilters
ActiveSheet.PivotTables("PivotTable3").PivotFields("JobDate").PivotFilters.Add _
Type:=xlDateBetween, Value1:="User input of start date", Value2:="User input of end date"

'Refreshes the Pivot Table
ActiveWorkbook.RefreshAll

Exit Sub



Any help could be much appreciated!