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

What is the last column in Excel?
Excel columns run from A to Z, AA to AZ, AAA to XFD. The last column is XFD.

Forum statistics

Threads
1,215,013
Messages
6,122,690
Members
449,092
Latest member
snoom82

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