VBA - Filter Pivot Table based on date range

AnimalisedZetec1

New Member
Joined
Oct 6, 2017
Messages
4
Hi Everyone,

I have tried different ways to get a result from this, some got me part of the way there but didn't work complete the task.

I'm trying to use date range from cells D1:D2 (from, until. First date is the 6/10/17(using today formula) and the second date is 10/10/17 (using workday formula)) to filter results in a dropdown list (Dates range).

Unsure how to tackle it!

Any help would be much appreciated!
Thank you in advance!
 

Excel Facts

Copy a format multiple times
Select a formatted range. Double-click the Format Painter (left side of Home tab). You can paste formatting multiple times. Esc to stop
At the moment i am using this method to select dates:

Code:
    ActiveSheet.PivotTables("PivotTable1").PivotFields("Order start date"). _
        CurrentPage = "(All)"
    With ActiveSheet.PivotTables("PivotTable1").PivotFields("Order start date")
        .PivotItems("7/21/2017").Visible = False
        .PivotItems("9/1/2017").Visible = False
        .PivotItems("9/15/2017").Visible = False
        .PivotItems("10/5/2017").Visible = False
        .PivotItems("10/11/2017").Visible = False
        .PivotItems("10/12/2017").Visible = False
        .PivotItems("10/13/2017").Visible = False
        .PivotItems("10/16/2017").Visible = False
        .PivotItems("10/17/2017").Visible = False
        .PivotItems("10/18/2017").Visible = False
        .PivotItems("(blank)").Visible = False
    End With

But this means changing the dates each time it needs using!
 
Upvote 0

Forum statistics

Threads
1,223,275
Messages
6,171,121
Members
452,381
Latest member
Nova88

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