+ Reply to Thread
Results 1 to 2 of 2

VBA To Refresh ALL Pivots

Hybrid View

  1. #1
    Forum Contributor
    Join Date
    01-19-2013
    Location
    Las Vegas, NV
    MS-Off Ver
    Office 365 2016
    Posts
    214

    VBA To Refresh ALL Pivots

    Hey Guys,

    So I found and used the following code before and it worked fine. Today I deleted a tab with that had a Pivot on it, but this vba is not specific...so I'm a little confused.

    Any help?

    Sub RefreshAllPivotTables()
    
    Dim PT As PivotTable
    Dim WS As Worksheet
    
        For Each WS In ActiveWorkbook.Worksheets
    
            For Each PT In WS.PivotTables
              PT.RefreshTable
            Next PT
    
        Next WS
    
    End Sub
    Also, if I attempt to refresh an individual table, it does not refresh neither. I have verified each of the tables' data ranges and they are correct-which are pointing to the same database.

    Edit: It tells me "The PivotTable field name is not valid. To create a pivot report . . . ." My data IS where it was originally, unchanged and I haven't changed any names of the tables, at all.
    Last edited by Miskondukt; 02-04-2014 at 08:28 PM. Reason: More info

  2. #2
    Valued Forum Contributor
    Join Date
    02-12-2011
    Location
    The Netherlands
    MS-Off Ver
    365
    Posts
    818

    Re: VBA To Refresh ALL Pivots

    Try this one.


    Sub RefreshAllPivotTables()
     thisworkbook.refreshall
    end sub
    Kind regards, Harry.

+ 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. [SOLVED] How to refresh pivots with reference cells
    By siddiq1212 in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 12-30-2013, 07:07 AM
  2. Not able to refresh all my pivots
    By ronnyl in forum Excel Charting & Pivots
    Replies: 7
    Last Post: 06-25-2013, 09:50 AM
  3. Auto Refresh pivots and totals
    By Ivor in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 06-09-2011, 07:35 AM
  4. Faulty refresh on Pivots
    By Shoeey in forum Excel Formulas & Functions
    Replies: 1
    Last Post: 09-05-2007, 05:04 AM
  5. [SOLVED] routine to refresh all pivots in WB acroos several sheets
    By Todd F. in forum Excel General
    Replies: 2
    Last Post: 08-17-2005, 08:05 AM

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