grouping PivotTable items

  • Thread starter Thread starter KT Doan
  • Start date Start date
K

KT Doan

Using Excel list to create a pivot table.

Sometimes I Excel doesn't allow me to group a date field -
saying "Cannot group that selection." If I delete this
pivot table and create a new table, it will now allow the
date field to be grouped.

I didn't make any changes to the source data.

What's the cause of this? It wasn't a problem when I was
creating a pivot table manually, but now I'm trying to
automate it within a macro, there's run-time error when it
gets the group statement.
 
this is usually symptomatic of a non date value being in the column of
dates - most likely a blank cell. This will prevent the group. I realize
you said you didn't change the data, but I would bet that you picked up an
extra row at the bottom (blank) or something like that in the original pivot
table and had a better selection when you created it a second time.
 
In addition to Tom's reply ...

I have found that creating PTs in code can be a minefield of problems.
However the PivotTableWizard method seems to be more robust. i.e.
start the macro recorder and set up manually.
 
Back
Top