I want to group dates by month and then set months into the xlColumnsField orientation. But I can't get the commented out section to work. Do you know how this can be done?
With TargetWks.PivotTables(Name).PivotFields("Project")
.Orientation = Excel.XlPivotFieldOrientation.xlRowField
.Position = 1
End With
With TargetWks.PivotTables(Name).PivotFields("Invoiced")
.Orientation = Excel.XlPivotFieldOrientation.xlPageField
.Position = 1
End With
With TargetWks.PivotTables(Name).PivotFields("Hours")
.Orientation = Excel.XlPivotFieldOrientation.xlDataField
.Position = 1
End With
TargetWks.PivotTables(Name).AddDataField(TargetWks.PivotTables(Name).PivotFields("Hours"), "Sum of Hours", Excel.XlConsolidationFunction.xlSum)
'TargetWks.PivotTables(Name).PivotFields("Date").Group(Start:=True, End:=True, Periods:={False, False, False, False, True, False, False})
'With TargetWks.PivotTables(Name).PivotFields("Date")
'.Orientation = Excel.XlPivotFieldOrientation.xlColumnField
'.Position = 1
'End With
Bookmarks