SAMCRO2014
Board Regular
- Joined
- Sep 3, 2015
- Messages
- 160
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?
' 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?