Need Help on Pivot table filters using VBA

crazyfunathome

New Member
Joined
Sep 4, 2014
Messages
1
Hello All,

I wrote a vba script in excel for pull the data from sheet1 and create Pivot table in sheet5.
And i have to sort the data in pivot table according to the date, so that i can get the Production report for one particular day.
Now i need to select date range (suppose from 01-Sep-2014 to 04-Sep-2014). but i wasn't able to find any way to do that. I'm not very good at VBA. i just google it and use some scripts.
Can anyone help me with this plz?

This is the existing code for one particular date:

Sub FetchRecord()
Dim Pdate As Date
Dim RowCount As Integer
Pdate = Sheet4.Range("C1").Value ' user input Production date (04-Sep-2014)
Sheet5.PivotTables(1).RefreshTable
Sheet5.PivotTables(1).PivotFields("DATE").ClearAllFilters
Sheet5.PivotTables(1).PivotFields("DATE").EnableMultiplePageItems = False
Sheet5.PivotTables(1).PivotFields("DATE").CurrentPage = Pdate
End Sub


Now i want to filter with date range from 01-Sep-2014 to 04-Sep-2014


Thanks in advance


Ramesh
 

Excel Facts

Which lookup functions find a value equal or greater than the lookup value?
MATCH uses -1 to find larger value (lookup table must be sorted ZA). XLOOKUP uses 1 to find values greater and does not need to be sorted.
Master Excel Bundle

Excel contains over 450 functions, with more added every year. That’s a huge number, so where should you start? Right here with this bundle.

Forum statistics

Threads
1,164,517
Messages
5,837,802
Members
430,516
Latest member
thaling

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
Top