PDA

View Full Version : Solved: Easy way to group date in Pivot Table



Djblois
09-11-2006, 12:45 PM
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

matthewspatrick
09-11-2006, 01:04 PM
This appears to work:


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)


In my limited testing, that grouped my date field into years and months, with really wide boundaries for the start/end dates.

Djblois
09-14-2006, 04:55 AM
Thank you that worked perfectly