Hello,
I'm working in a Datavision Pivot table - not sure if that makes a difference.
I'm trying to change my pivot table date based on a cell value but I can't seem to find any code that works.
Keep getting a runtime error 1004
"unable to get the pivotfields property of the pivotTable Class"
Here is snapshot of my data: sorry not sure how to get this pasted in a better format
I'm working in a Datavision Pivot table - not sure if that makes a difference.
I'm trying to change my pivot table date based on a cell value but I can't seem to find any code that works.
Keep getting a runtime error 1004
"unable to get the pivotfields property of the pivotTable Class"
Code:
Sub Macro1()
Dim d As String
d = "09/30/2017" 'Eventually this will equal cell "F2"
Worksheets("DV").PivotTables("PivotTable1").PivotFields("date").PivotFilters.Add Type:=xlDateBetween, Value1:=d, Value2:=d
End Sub
Here is snapshot of my data: sorry not sure how to get this pasted in a better format
Code:
[TABLE="width: 513"]
<tbody>[TR]
[TD]POS 1 Tender
[/TD]
[TD](Multiple Items)
[/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD="align: right"]10/1/2017
[/TD]
[/TR]
[TR]
[TD]POS 1 Category
[/TD]
[TD]Revenues
[/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD]09/30/2017
[/TD]
[/TR]
[TR]
[TD]POS 1 Outlet
[/TD]
[TD]Banquets & Catering
[/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[/TR]
[TR]
[TD]Date
[/TD]
[TD]09/29/2017
[/TD]
[TD][/TD]
[TD][/TD]
[TD]Check Audit Report
[/TD]
[/TR]
[TR]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[/TR]
[TR]
[TD]Amount
[/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[/TR]
[TR]
[TD]Level00
[/TD]
[TD]Level01
[/TD]
[TD]Total
[/TD]
[TD][/TD]
[TD][/TD]
[TD]Date
[/TD]
[/TR]
</tbody>[/TABLE]