ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Pivot create (https://www.excelbanter.com/excel-programming/284378-pivot-create.html)

Jesse[_4_]

Pivot create
 
Can anyone help me figure out why this line of code does not work?

ActiveWorkbook.PivotTableWizard SourceType:=xlDatabase,
SourceData:=Sheets("BDData").UsedRange,
tabledestination:=Sheets("BD").Cells(1, 5), tablename:="BDPivot"


Jesse



Bill Manville

Pivot create
 
Jesse wrote:
Can anyone help me figure out why this line of code does not work?

ActiveWorkbook.PivotTableWizard SourceType:=xlDatabase,
SourceData:=Sheets("BDData").UsedRange,
tabledestination:=Sheets("BD").Cells(1, 5), tablename:="BDPivot"


PivotTableWizard is a method of a worksheet, not a workbook.
So try

Sheets("BD").PivotTableWizard SourceType:=xlDatabase,
SourceData:=Sheets("BDData").UsedRange,
tabledestination:=Sheets("BD").Cells(1, 5), tablename:="BDPivot"


Bill Manville
MVP - Microsoft Excel, Oxford, England
No email replies please - reply in newsgroup



All times are GMT +1. The time now is 02:16 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
ExcelBanter.com