Anybody know an easy way to group the date in a Pivottable with VBA? Right now all I can find is I have to select the column name or one of the dates and then group it. Is there an easier way?
Daniel
Anybody know an easy way to group the date in a Pivottable with VBA? Right now all I can find is I have to select the column name or one of the dates and then group it. Is there an easier way?
Daniel
This appears to work:
[VBA]
Dim pf As PivotField
Set pf = pt.PivotFields("Date")
pf.LabelRange.Group Start:=7306, End:=73051, Periods:=Array(False, False, False _
, False, True, False, True)
[/VBA]
In my limited testing, that grouped my date field into years and months, with really wide boundaries for the start/end dates.
Regards,
Patrick
I wept for myself because I had no PivotTable.
Then I met a man who had no AutoFilter.
Microsoft MVP for Excel, 2007 & 2008
Thank you that worked perfectly