Hi guys,
Where am I going wrong here.
I am trying to set dynamic dates for my Pivot Table Group.
Code
Dim StartDate As Date
Dim EndDate As Date
Dim PT As PivotTable
StartDate = Range("M1").Value
EndDate = Range("N1").Value
Set PT = ActiveSheet.PivotTables("PivotTable3")
[B]PT.DateRange.Group Start:=CLng(StartDate), End:=CLng(EndDate), By:=1, Periods:=Array(False, False, False, False, True, False, True)[/B]
ActiveSheet.PivotTables("PivotTable3").PivotCache.Refresh
End Sub
I am getting a runtime error: 428 "Object doesn't support this property or method" and it highlights the PT.DateRange.Group line in bold above...