Creating a Pivot with a Macro

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • flickimp
    New Member
    • Dec 2006
    • 37

    #1

    Creating a Pivot with a Macro

    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"
  • flickimp
    New Member
    • Dec 2006
    • 37

    #2
    Still need help on this?????

    Comment

    Working...