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
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