D
Daniel
Hi Everyone,
I have recorded a macro that will pivot some data. Each
month I get a fresh batch of data that needs to be
pivoted in the same way. Each month though the amount of
records increases, although the format stays the same, so
at the moment I go into the VBA code and change the
number of rows that excel with pivot tom allow for the
new number of records. Is it possible to uise some code
code to tell excel to look untill there are no more
records to know how much data to pivot.
I don't know a great deal about VBA just stuff I've
picked up along the way so I won't kow where to put it if
there is some code available: here is a sample of my code:
Range("A1").Select
ActiveWorkbook.PivotCaches.Add
(SourceType:=xlDatabase, SourceData:= _
"Sheet1!R1C1:R8830C23").CreatePivotTable
TableDestination:="", TableName:= _
"PivotTable2",
DefaultVersion:=xlPivotTableVersion10
ActiveSheet.PivotTableWizard
TableDestination:=ActiveSheet.Cells(3, 1)
ActiveSheet.Cells(3, 1).Select
I have recorded a macro that will pivot some data. Each
month I get a fresh batch of data that needs to be
pivoted in the same way. Each month though the amount of
records increases, although the format stays the same, so
at the moment I go into the VBA code and change the
number of rows that excel with pivot tom allow for the
new number of records. Is it possible to uise some code
code to tell excel to look untill there are no more
records to know how much data to pivot.
I don't know a great deal about VBA just stuff I've
picked up along the way so I won't kow where to put it if
there is some code available: here is a sample of my code:
Range("A1").Select
ActiveWorkbook.PivotCaches.Add
(SourceType:=xlDatabase, SourceData:= _
"Sheet1!R1C1:R8830C23").CreatePivotTable
TableDestination:="", TableName:= _
"PivotTable2",
DefaultVersion:=xlPivotTableVersion10
ActiveSheet.PivotTableWizard
TableDestination:=ActiveSheet.Cells(3, 1)
ActiveSheet.Cells(3, 1).Select