Have created a macro to recreate a Pivot whenever the user has new data.
The macro breaks in the bold section.....
Sheets("PASTE YOUR DATA HERE").Select
Range("C21").Se lect
ActiveWorkbook. PivotCaches.Add (SourceType:=xl Database, SourceData:= _
"'PASTE YOUR DATA HERE'!C1:C18"). CreatePivotTabl e TableDestinatio n:="", _
TableName:="Piv otTable1", DefaultVersion: =xlPivotTableVe rsion10
ActiveSheet.Piv otTableWizard TableDestinatio n:=ActiveSheet. Cells(3, 1)
ActiveSheet.Cel ls(3, 1).Select
ActiveSheet.Piv otTables("Pivot Table1").AddFie lds RowFields:= _
"Treatment_Func tion", ColumnFields:=" Referral_Month" , PageFields:=Arr ay( _
"Referral_Sourc e", "Provider") ActiveSheet.Piv otTables("Pivot Table1").PivotF ields("PCT").Or ientation = _
xlDataField
ActiveSheet.Piv otTables("Pivot Table1").PivotF ields("Treatmen t_Function"). _
AutoSort xlDescending, "Count of PCT"
The macro breaks in the bold section.....
Sheets("PASTE YOUR DATA HERE").Select
Range("C21").Se lect
ActiveWorkbook. PivotCaches.Add (SourceType:=xl Database, SourceData:= _
"'PASTE YOUR DATA HERE'!C1:C18"). CreatePivotTabl e TableDestinatio n:="", _
TableName:="Piv otTable1", DefaultVersion: =xlPivotTableVe rsion10
ActiveSheet.Piv otTableWizard TableDestinatio n:=ActiveSheet. Cells(3, 1)
ActiveSheet.Cel ls(3, 1).Select
ActiveSheet.Piv otTables("Pivot Table1").AddFie lds RowFields:= _
"Treatment_Func tion", ColumnFields:=" Referral_Month" , PageFields:=Arr ay( _
"Referral_Sourc e", "Provider") ActiveSheet.Piv otTables("Pivot Table1").PivotF ields("PCT").Or ientation = _
xlDataField
ActiveSheet.Piv otTables("Pivot Table1").PivotF ields("Treatmen t_Function"). _
AutoSort xlDescending, "Count of PCT"
Comment