Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
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
Posted to microsoft.public.excel.programming
|
|||
|
|||
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 |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
Filter lines with Pivot table and non pivot table columns | Charts and Charting in Excel | |||
Filter lines with Pivot table and non Pivot table columns | Excel Discussion (Misc queries) | |||
Entering Variable in a Pivot Table | Excel Discussion (Misc queries) | |||
Pivot Table variable range | Excel Programming | |||
Pivot Table - Object variable or with block variable not set? | Excel Programming |