I am trying to create a macro that will make a pivot table. In the attached sheet, I am starting in the name Angelo Brocato and am recording a macro by going to insert, pivot table, and then grabbing all the data from A:AI. The following is the Macro which can be seen in the workbook. How do I fix this so I do not have to debug it?
Sub Macro1()
'
' Macro1 Macro
'
' Keyboard Shortcut: Ctrl+m
'
ActiveWorkbook.PivotCaches.Create(SourceType:=xlDatabase, SourceData:= _
"Data!R1C1:R1048576C35", Version:=xlPivotTableVersion14).CreatePivotTable _
TableDestination:="Angelo Brocato!R4C7", TableName:="PivotTable12", _
DefaultVersion:=xlPivotTableVersion14
Sheets("Angelo Brocato").Select
Cells(4, 7).Select
ActiveSheet.PivotTables("PivotTable12").AddDataField ActiveSheet.PivotTables( _
"PivotTable12").PivotFields("Name"), "Count of Name", xlCount
End Sub
Bookmarks