Hello
I have a problem in trying to create a pivottable using external data.
The following errors are displayed when run
-Unable to set the orientation property of the Pivotfield class
-Unable to set the position property of the Pivotfield class
-Unable to set the function property of the Pivotfield class
-Application defined or object defined error
this is the code where the error occurs
Any help in fixing this problem is appreciatedCode:dataSheet.PivotTableWizard SourceType:=xlDatabase, SourceData:= _ dataSheet.Range(dataSheet.Cells(1, 1), _ dataSheet.Cells(dataSheet.Cells(1, 1).End(xlDown).Row, _ dataSheet.Cells(1, 1).End(xlToRight).Column)), _ TableDestination:=.Cells(14, 1), TableName:="CashReqsPivotTable" With .PivotTables("CashReqsPivotTable") .PivotFields("Vendor Number").Subtotals = NoSubtotalsArray .PivotFields("Invoice Number").Subtotals = NoSubtotalsArray .PivotFields("Document Date").Subtotals = NoSubtotalsArray .PivotFields("Due Date").Subtotals = NoSubtotalsArray .AddFields RowFields:=Array("Vendor Number", "Vendor Name", _ "Invoice Number", "Document Date", "Due Date", "Data"), _ PageFields:=Array("Terms", "Vendor Currency", "Account Set", _ "Vendor Group") 'Setup the aging period columns With .PivotFields("Overdue ") .Orientation = xlDataField .Name = "Overdue" .Function = xlSum .NumberFormat = numFormat .Position = 1 End With With .PivotFields("Current ") .Orientation = xlDataField .Name = "Current" .Function = xlSum .NumberFormat = numFormat .Position = 2 End With
Regards
AP


Reply With Quote