Results 1 to 4 of 4

Thread: Excel VBA Macro To Dynamically Change Source for Pivot Table

Hybrid View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Administrator Excel Fox's Avatar
    Join Date
    Mar 2011
    Posts
    1,401
    Rep Power
    10
    Code:
        Worksheets("Pivot Table").PivotTables("PivotTable4").ChangePivotCache _
        ActiveWorkbook.PivotCaches.Create _
            (SourceType:=xlDatabase, SourceData:=Worksheets("Imported Data").Range("A1:L" & _
            Worksheets("Imported Data").Cells(Rows.Count, 1).End(xlUp).Row).Address(External:=True), _
            Version:=xlPivotTableVersion14)
    A dream is not something you see when you are asleep, but something you strive for when you are awake.

    It's usually a bad idea to say that something can't be done.

    The difference between dream and aim, is that one requires soundless sleep to see and the other requires sleepless efforts to achieve

    Join us at Facebook

  2. #2
    Senior Member
    Join Date
    Apr 2012
    Posts
    193
    Rep Power
    14
    Thanks for the help, much appreciated

Similar Threads

  1. Replies: 1
    Last Post: 05-03-2013, 04:41 PM
  2. Replies: 2
    Last Post: 04-26-2013, 04:59 PM
  3. Replace Pivot Table Source Range with New Address VBA
    By Admin in forum Excel and VBA Tips and Tricks
    Replies: 1
    Last Post: 04-25-2013, 07:51 PM
  4. Create a Pivot table
    By NITIN SHETTY in forum Excel Help
    Replies: 3
    Last Post: 01-26-2013, 11:01 AM
  5. Lookup and Count Using Pivot Table
    By RobExcel in forum Excel Help
    Replies: 2
    Last Post: 12-21-2012, 11:08 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •