Home |
Search |
Today's Posts |
|
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Hi
I am trying to create a pivot table using VBA. I have a workbook in which sheet1 has data, I have a commondbutton on sheet2 and on click on this button , I am trying to create pivot table on sheet PivotSheet My PivotSheet gets created but with no pivot table data. Please advise what am I doing wrong in this code Dim ptcache As PivotCache Dim pt As PivotTable Application.ScreenUpdating = False On Error Resume Next Application.DisplayAlerts = False Sheets("PivotSheet").Delete On Error GoTo 0 Set ptcache = ActiveWorkbook.PivotCaches.Add( _ SourceType:=xlDatabase, _ SourceData:=Sheets("Sheet1").Range("A1").CurrentRe gion.Address) Worksheets.Add ActiveSheet.Name = "PivotSheet" Set pt = ptcache.CreatePivotTable( _ TableDestination:=Sheets("PivotSheet").Range("A1") , _ TableName:="File") With pt .PivotFields(3).Orientation = x1RowField .PivotFields(15).Orientation = x1ColumnField .PivotFields(5).Orientation = x1DataField End With |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
how to create pivot table from existing pivot table in excel 2007 | Excel Discussion (Misc queries) | |||
Pivot Table and Pivot Table dates are not in correct order | Charts and Charting in Excel | |||
Copying values from pivot table to cells outside pivot table | Excel Discussion (Misc queries) | |||
How do I create a pivot table if the pivot table icon or menu ite. | Charts and Charting in Excel | |||
Help required with setting up a pivot table with the source on sheet1 to have the pivot table created on sheet called "report" | Excel Programming |