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