Error Invalid Procedure Call Or Argument Excel
Contents |
Forums Excel Questions Runtime error 5, Invalid Procedure call or argument error when creating a pivot table Page 1 of 2 12 Last excel vba invalid procedure call or argument pivot table Jump to page: Results 1 to 10 of 13 Runtime error 5, runtime error 5 invalid procedure call or argument fix Invalid Procedure call or argument error when creating a pivot tableThis is a discussion on Runtime error 5, run-time error '5': invalid procedure call or argument Invalid Procedure call or argument error when creating a pivot table within the Excel Questions forums, part of the Question Forums category; Hello All, I'm trying to record a macro https://partners.sagenorthamerica.com/irj/go/km/docs/sageKM/Simply%20Accounting%20by%20Sage/Ungated%20Customers/260-1004849.xml that inserts a pivot table from data from one worksheet onto a ... LinkBack LinkBack URL About LinkBacks Bookmark & Share Digg this Thread!Add Thread to del.icio.usBookmark in TechnoratiTweet this thread Thread Tools Show Printable Version Display Linear Mode Switch to Hybrid Mode Switch to Threaded Mode Aug 11th, 2011,02:03 PM #1 VBAProIWish Board Regular Join Date Jul http://www.mrexcel.com/forum/excel-questions/571113-runtime-error-5-invalid-procedure-call-argument-error-when-creating-pivot-table.html 2009 Posts 862 Runtime error 5, Invalid Procedure call or argument error when creating a pivot table Hello All, I'm trying to record a macro that inserts a pivot table from data from one worksheet onto a newly created worksheet, but I'm getting this error here... "runtime 5" "Invalid procedure call or argument" The code in RED is the code below that it bugs on. Code: Sheets.Add After:=Sheets(Sheets.Count) Sheets("Sheet2").Name = "Cht-P" Sheets("DB-P").Select Range("A1").Select Selection.CurrentRegion.Select ActiveWorkbook.PivotCaches.Create(SourceType:=xlDatabase, SourceData:= _ "DB-P!R1C1:R6674C5", Version:=xlPivotTableVersion12).CreatePivotTable _ TableDestination:="Cht-P!R1C1", TableName:="PivotTable1", _ DefaultVersion:=xlPivotTableVersion12 Sheets("Cht-P").Select Cells(1, 1).Select ActiveSheet.Shapes.AddChart.Select ActiveChart.SetSourceData Source:=Range("'Cht-P!$A$1:$C$18") ActiveWorkbook.ShowPivotChartActiveFields = True ActiveChart.ChartType = xl3DColumnClustered ActiveWorkbook.ShowPivotChartActiveFields = False Can anyone help me fix this? Thanks much! Share Share this post on Digg Del.icio.us Technorati Twitter I can't wait to change my name to "VBAPROIAM" Using Excel 2010 Reply With Quote Aug 12th, 2011,09:16 AM #2 VBAProIWish Board Regular Join Date Jul 2009 Posts 862 Re: Runtime error 5, Invalid Procedure call or argument error when creating a pivot table Does anyone know why I'm getting this error? Share Share this post on Digg Del.icio.us Technorati Tw
here for a quick overview of the site Help Center Detailed answers to any http://stackoverflow.com/questions/17020446/invalid-procedure-call-or-argument-when-creating-a-pivot-table questions you might have Meta Discuss the workings and policies of this site About Us Learn more about Stack Overflow the company Business Learn more about hiring developers or posting ads with us Stack Overflow Questions Jobs Documentation Tags Users Badges Ask Question x Dismiss Join the Stack Overflow Community Stack invalid procedure Overflow is a community of 4.7 million programmers, just like you, helping each other. Join them; it only takes a minute: Sign up Invalid Procedure Call or Argument when Creating a Pivot Table up vote 1 down vote favorite Trying to create a Pivot Table out of a set of Data. Usually invalid procedure call it runs fine the first time, but if you try and run it a second time it throws an "Invalid Procedure Call or Argument" and when you click debug the code highlights the below as the issue. Changing the Name of the Pivot Table doesn't help. Sheet 2 exists and is populated with data. The Data-Summary sheet also exists and is completely empty ActiveWorkbook.PivotCaches.Create(SourceType:=xlDatabase, SourceData:= _ "Sheet2!R1C1:R1064C4", Version:=xlPivotTableVersion14).CreatePivotTable _ TableDestination:="Data-Summary!R5C1", TableName:="PivotTable4", _ DefaultVersion:=xlPivotTableVersion The whole code is as below: Sub Macro1() ' ' Macro1 Macro ' ' Columns("A:D").Select ActiveWorkbook.PivotCaches.Create(SourceType:=xlDatabase, SourceData:= _ "Sheet2!R1C1:R1064C4", Version:=xlPivotTableVersion14).CreatePivotTable _ TableDestination:="Data-Summary!R5C1", TableName:="PivotTable15", _ DefaultVersion:=xlPivotTableVersion14 Sheets("Data-Summary").Select Cells(5, 1).Select ActiveWorkbook.ShowPivotTableFieldList = True With ActiveSheet.PivotTables("PivotTable3").PivotFields("Site") .Orientation = xlRowField .Position = 1 End With With ActiveSheet.PivotTables("PivotTable3").PivotFields("Channel") .Orientation = xlColumnField .Position = 1 End With ActiveSheet.PivotTables("PivotTable3").AddDataField ActiveSheet.PivotTables( _ "PivotTable3").PivotFields("Cost"), "Count of Cost", xlCount ActiveSheet.PivotTables("PivotTable3").PivotFields("Count of Cost"). _ Orientation = xlHidden ActiveSheet.PivotTables("PivotTable3").AddDataField ActiveSheet.PivotTables( _ "PivotTable3").PivotFields("Revenue"), "Count of Revenue", xlCount With ActiveSheet.PivotTables("PivotTable3").PivotFields("Count of Revenue") .Caption = "