+ Reply to Thread
Results 1 to 4 of 4

VBA to update Pivot table

  1. #1
    JR
    Guest

    VBA to update Pivot table

    Hello,

    Can someone provide the code I can use to automatically update my pivot
    tables upon opening the workbook.

    Thanks


  2. #2
    Jim Thomlinson
    Guest

    RE: VBA to update Pivot table

    Why use code? Pivot tables have an option to refresh on open under the table
    options if I recall correctly.
    --
    HTH...

    Jim Thomlinson


    "JR" wrote:

    > Hello,
    >
    > Can someone provide the code I can use to automatically update my pivot
    > tables upon opening the workbook.
    >
    > Thanks
    >


  3. #3
    Edwin Tam
    Guest

    RE: VBA to update Pivot table

    Yes, Jim was right.

    You just need to right-click the pivot table, choose "Table Options". Check
    the "Refresh On Open" checkbox. (And save you file.)

    In case you really want to know the statement for updating a Pivot table, it
    will look like this:
    ActiveSheet.PivotTables(1).PivotCache.Refresh

    Regards,
    Edwin Tam
    [email protected]
    http://www.vonixx.com


    "Jim Thomlinson" wrote:

    > Why use code? Pivot tables have an option to refresh on open under the table
    > options if I recall correctly.
    > --
    > HTH...
    >
    > Jim Thomlinson
    >
    >
    > "JR" wrote:
    >
    > > Hello,
    > >
    > > Can someone provide the code I can use to automatically update my pivot
    > > tables upon opening the workbook.
    > >
    > > Thanks
    > >


  4. #4
    Registered User
    Join Date
    02-09-2006
    Posts
    7

    pivot tables DO NOT update on open....

    excel 9 (2000) and VBA 6 on XP

    If I open a workbook with pivot tables linked to database and set for 'refresh on open'; i get a 'query refresh' dialog asking if i want to update. Fine, i can click yes, update. The pivot tables then update.

    However.... If I use code to open the same workbook, no dialog appears, and no automatic query / pivot table updates take place.

    my question is:

    can i force the pivot tables in a workbook to refresh when opened using code?

    I guess i will have to do the following:

    open workbook
    loop through worksheets
    loop through all pivot tales on worksheet
    refresh pivot table
    next
    next
    close workbook

    andy other ideas on a quick way to force all to be updated? Afterall, you can refresh data from any linked FILES to on file open...

    any good ideas folks?????

    andy

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

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