+ Reply to Thread
Results 1 to 4 of 4

VBA - Auto refresh Pivot Tables

Hybrid View

  1. #1
    Registered User
    Join Date
    09-02-2015
    Location
    Massachusetts
    MS-Off Ver
    Excel for Mac 2011, Ver. 14.4.7
    Posts
    6

    VBA - Auto refresh Pivot Tables

    Hello excellers,

    I'm new to the VBA world! Trying to learn as much as possible.

    At the moment, I am trying to auto refresh a pivot table every time new data is added into the original table.

    This is for Excel 2011 for Mac and so far any 'code' I try to write or use just gives me a bunch of error messages or infinitely loops to the beach ball of death.

    The example I posted will give a quick idea of what I'm trying to accomplish.

    I want to be able to select the difference alternatives and have the pivot table change automatically when the different alternatives are chosen.

    This is the script i'm using...but it doesn't seem to be working for my Apple product!


    Private Sub Worksheet_Change(ByVal Target As Range)
      Worksheets("Data").PivotTables("PivotTable2").PivotCache.Refresh
    End Sub
    Attached Files Attached Files
    Last edited by alansidman; 09-03-2015 at 02:22 PM.

  2. #2
    Forum Moderator alansidman's Avatar
    Join Date
    02-02-2010
    Location
    Steamboat Springs, CO
    MS-Off Ver
    MS Office 365 insider Version 2504 Win 11
    Posts
    24,714

    Re: VBA - Auto refresh Pivot Tables

    try this:
    Private Sub Worksheet_Calculate()
    
       'If data on this worksheet changes, refresh the pivot table
       Sheets("Data").PivotTables("PivotTable2").RefreshTable
       
    End Sub
    Alan עַם יִשְׂרָאֵל חַי


    Change an Ugly Report with Power Query
    Database Normalization
    Complete Guide to Power Query
    Man's Mind Stretched to New Dimensions Never Returns to Its Original Form

  3. #3
    Registered User
    Join Date
    09-02-2015
    Location
    Massachusetts
    MS-Off Ver
    Excel for Mac 2011, Ver. 14.4.7
    Posts
    6

    Re: VBA - Auto refresh Pivot Tables

    Thanks!!

    That worked great!

  4. #4
    Forum Moderator alansidman's Avatar
    Join Date
    02-02-2010
    Location
    Steamboat Springs, CO
    MS-Off Ver
    MS Office 365 insider Version 2504 Win 11
    Posts
    24,714

    Re: VBA - Auto refresh Pivot Tables

    If that takes care of your original question, please select Thread Tools from the menu link above and mark this thread as SOLVED. Thanks.

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. Auto refresh pivot tables when data changes with slight twist
    By rs1aj in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 06-01-2015, 11:25 AM
  2. Refresh All Pivot Tables
    By smyuen in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 12-28-2012, 10:05 PM
  3. Auto-refresh pivot tables in worksheet_change event?
    By 1eyedjack in forum Excel Programming / VBA / Macros
    Replies: 11
    Last Post: 03-01-2012, 03:00 PM
  4. Refresh pivot tables
    By rhyan66 in forum Excel General
    Replies: 3
    Last Post: 09-16-2010, 11:52 AM
  5. Auto Refresh Pivot Tables
    By Marcus Hartley in forum Excel General
    Replies: 2
    Last Post: 06-03-2007, 12:49 PM
  6. [SOLVED] refresh pivot tables
    By bp in forum Excel General
    Replies: 5
    Last Post: 04-04-2006, 02:45 PM
  7. [SOLVED] Pivot Tables -- Auto Refresh
    By Aastha in forum Excel General
    Replies: 1
    Last Post: 03-30-2006, 03:15 PM

Bookmarks

Posting Permissions

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

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1