Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2
Default Pivot Table with variable # of columns

I am trying to create a pivot table using VBA and will have a different
amount of data columns each month. In January, for example, i will only have
January, but in February, i will have january and February and so forth. So
far, i haven't found a way to do it.

Any help would be greatly appreciated.
Thanks!
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2,979
Default Pivot Table with variable # of columns

You could use the address of the current region, e.g.:

Dim rng As Range

Set rng = Worksheets("Data").Range("A1").CurrentRegion
ActiveWorkbook.PivotCaches.Add(SourceType:=xlDatab ase, _
SourceData:=rng.Address).CreatePivotTable _
TableDestination:="", TableName:="PivotTable1"

samlyon wrote:
I am trying to create a pivot table using VBA and will have a different
amount of data columns each month. In January, for example, i will only have
January, but in February, i will have january and February and so forth. So
far, i haven't found a way to do it.

Any help would be greatly appreciated.
Thanks!



--
Debra Dalgleish
Contextures
http://www.contextures.com/tiptech.html

Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Filter lines with Pivot table and non pivot table columns Grover Charts and Charting in Excel 4 September 28th 07 03:16 AM
Filter lines with Pivot table and non Pivot table columns Grover Excel Discussion (Misc queries) 1 September 26th 07 12:48 AM
Entering Variable in a Pivot Table flyer27 Excel Discussion (Misc queries) 0 March 13th 07 03:05 PM
Pivot Table variable range La Durande Excel Programming 1 October 18th 04 08:42 PM
Pivot Table - Object variable or with block variable not set? George Nicholson[_2_] Excel Programming 1 April 16th 04 09:12 PM


All times are GMT +1. The time now is 07:41 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"