laxminarayana
Board Regular
- Joined
- Nov 16, 2013
- Messages
- 56
Hello,
My pivot table contains dates and product received. I am trying automate the filtering of date in pivot, so that when i enter a date in a desired cell, pivot would filter with the date in the cell and return the number. I have put up the following code to achieve this. But ended up with error as 'expected end of statement'. Please help me to fix the code.
Thanks
My pivot table contains dates and product received. I am trying automate the filtering of date in pivot, so that when i enter a date in a desired cell, pivot would filter with the date in the cell and return the number. I have put up the following code to achieve this. But ended up with error as 'expected end of statement'. Please help me to fix the code.
Code:
Sub Macro1()Dim ws1 As Worksheet: Set ws1 = Sheets("Sheet1")
ActiveSheet.PivotTables("PivotTable1").RefreshTable
ActiveSheet.PivotTables("PivotTable1").PivotFields("OrderDate").ClearAllFilters
ActiveSheet.PivotTables("PivotTable1").PivotFields("OrderDate").PivotFilters. _
Add Type:=xlSpecificDate, Value1:="ws1.Range("F1").Value"
End With
End Sub
Thanks