Macro allowing user input to auto filter on pivot table

markecs

New Member
Joined
Jul 14, 2014
Messages
1
Hello all.

I have scratching beneath the surface of Excel for a little while now, but I'm finally stumped and hope to find some help here from someone with a little more knowledge...

I am trying to write a macro that prompts the user to change the date range in a pivot table report. My current code is:

Sheets("Report").Select
ActiveSheet.PivotTables("PivotTable1").PivotCache.Refresh
ActiveSheet.PivotTables("PivotTable1").PivotFields("Date").PivotFilters.Add _
Type:=xlDateBetween, Value1:="05/06/2014", Value2:="04/07/2014"


Is the any way to make the macro stop at the point before Value1 and Value2 entered, or some other way of specifying the date range in advance of running the macro and then utilising the specified dates within the macro?

Any help most appreciated, I have been running around in circles trying to find a solution!
 

Excel Facts

Save Often
If you start asking yourself if now is a good time to save your Excel workbook, the answer is Yes

Forum statistics

Threads
1,216,589
Messages
6,131,596
Members
449,657
Latest member
Timber5

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top