Problems with VBA coding to Create Pivot Tables after upgrade to Excel 2016

SAMCRO2014

Board Regular
Joined
Sep 3, 2015
Messages
158
I am trying to run all my macros to ensure they work since being upgraded to Office 2016. I am getting a "debug" error whenever the coding is trying to create a pivot table. I even recorded the steps via the macro recorder and it still does not like the coding. Here is the portion of the coding creating the pivot table.

' Create table called "Data" with information on 'Data' tab
Range("A1").Select
Range(Selection, Selection.End(xlToRight)).Select
Range(Selection, ActiveCell.SpecialCells(xlLastCell)).Select
ActiveSheet.ListObjects.Add(xlSrcRange, Range("$A$1:$X$33000"), , xlYes).Name = _
"All_Data"

'Add new worksheet to create pivot table for all of RC
Sheets.Add After:=ActiveSheet
Sheets("Sheet1") = "RC 1203 - All"
Range("A1").Select

'Create Pivot Table on 'RC 1203 - All' worksheet with classic view and create Pivot Table Cache
ActiveWorkbook.PivotCaches.Create(SourceType:=xlDatabase, SourceData:= _
"All_Data", Version:=6).CreatePivotTable TableDestination:= _
"RC 1203 - All!R1C1", TableName:="PivotTable1", DefaultVersion:=6

Sheets("RC 1203 - All").Select
With ActiveSheet.PivotTables("PivotTable1")
.InGridDropZones = True
.ShowDrillIndicators = False
.RowAxisLayout xlTabularRow
End With

it does not like the bolded section even though I recorded the steps. Is this an issue with Excel 2016?
 

Excel Facts

Spell Check in Excel
Press F7 to start spell check in Excel. Be careful, by default, Excel does not check Capitalized Werds (whoops)
The sheet reference for the table destination needs to be enclosed within single quotes since it contains spaces...

Code:
TableDestination:="'RC 1203 - All'!R1C1"

Hope this helps!
 
Last edited:
Upvote 0

Forum statistics

Threads
1,214,523
Messages
6,120,028
Members
448,940
Latest member
mdusw

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top