programmatic grouping of columns in pivot table

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

I've built a pivot table programmatically in VB.net using the Excel OM . The
columns of the table are Jan, Feb, Mar, etc. and I would like to group them
programmatically into Quarters also but can't figure out what the code should
be. I'd also like to have subtotals for the Quarters. Can someone provide the
code for this or point me to something that would help?

Thanks,

Jerry
 
Are your dates just the months, or are they actual dates? If they are actual
dates then you just need to change your grouping to include, Quarters and
Years... Teh Pivot Table engine changed in xl2002, so any code would have to
be written for your version of Excel. You could just record a macro if you
have actual dates. If you do not have actual dates then you are going to have
to do some programming to add a dimension (column) to your source data with
indicates the quarter, based on the month.
 
Jim Thomlinson said:
Are your dates just the months, or are they actual dates? If they are actual
dates then you just need to change your grouping to include, Quarters and
Years... Teh Pivot Table engine changed in xl2002, so any code would have to
be written for your version of Excel. You could just record a macro if you
have actual dates. If you do not have actual dates then you are going to have
to do some programming to add a dimension (column) to your source data with
indicates the quarter, based on the month.

Jim,

The columns are just month abbreviations. If I grouping manually in a pivot
table I can group by months, quarters and even get subtotals by quarters.
I've tried recording a macro for these clicks but the code I get from the
macro just doesn't seem to work in VB.net. I was hoping you might have some
code that actually does grouping of columns. Any help would be appreciated.

I could format the columns for something like 1/31/06, 2/28/06 ... If I did
that I still don't know how to program the gouping. Can you help with that?
I'm using Excel 2003 and VB.net (Visual Studio 2005)

Thanks,
jerry
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top