Hi,
I am looking for a Macro to create a Pivot table. The data will change every time and it should not through errors if I use the same Macro.
I have tried and getting the below error. Its working for the same work book for not the new data, Please help.
----------------------------------------------------------------------------------------------------------------------------------
Sub Pradeep()
'
' Pradeep Macro
' Test for Pivot
'
'
Sheets.Add
ActiveWorkbook.PivotCaches.Create(SourceType:=xlDatabase, SourceData:= _
"Report!R1C1:R3360C11", Version:=xlPivotTableVersion10).CreatePivotTable _
TableDestination:="Sheet1!R3C1", TableName:="PivotTable1", DefaultVersion _
:=xlPivotTableVersion10
Sheets("Sheet1").Select
Cells(3, 1).Select
ActiveSheet.PivotTables("PivotTable1").AddDataField ActiveSheet.PivotTables( _
"PivotTable1").PivotFields("Ticket Number"), "Count of Ticket Number", xlCount
With ActiveSheet.PivotTables("PivotTable1").PivotFields("Assigned To Group")
.Orientation = xlRowField
.Position = 1
End With
With ActiveSheet.PivotTables("PivotTable1").PivotFields("Status")
.Orientation = xlColumnField
.Position = 1
End With
End Sub
Thanks in advance for all your help!!
Regards,
Pradeep Kodali
Bookmarks