+ Reply to Thread
Results 1 to 5 of 5

Waiting command to refresh pivot table

  1. #1
    Registered User
    Join Date
    01-10-2013
    Location
    Australia
    MS-Off Ver
    Excel 2010
    Posts
    37

    Waiting command to refresh pivot table

    Hi

    I have a sheet named "PivotTable" with data and its pivot table in it. I have date on another sheet and link it to "PivotTable" sheet. I use the following code to refresh the pivot table whenever I change date in another sheet. The code is embedded in "PivotTable" sheet and it works:

    Please Login or Register  to view this content.

    But then I want to wait for three seconds before refreshing the pivot table using the Waiting command like this:

    Please Login or Register  to view this content.
    Excel will keeping calculating/waiting forever until I press Esc, and then the debug will pop up and highlight the last line in yellow:

    Please Login or Register  to view this content.

    Any idea why this is the case, did I misuse the waiting command?


    Thank you.
    Last edited by kanonathena; 10-15-2013 at 10:06 PM.

  2. #2
    Forum Guru MarvinP's Avatar
    Join Date
    07-23-2010
    Location
    Woodinville, WA
    MS-Off Ver
    Office 365
    Posts
    16,169

    Re: Waiting command to refresh pivot table

    Hi,

    Look at http://msdn.microsoft.com/en-us/libr.../ff822851.aspx and see better code that claims to use:
    Please Login or Register  to view this content.
    One test is worth a thousand opinions.
    Click the * Add Reputation below to say thanks.

  3. #3
    Registered User
    Join Date
    01-10-2013
    Location
    Australia
    MS-Off Ver
    Excel 2010
    Posts
    37

    Re: Waiting command to refresh pivot table

    Hi Marvin

    Thanks for the response. I change the waiting code but the I still have to press Esc and debug still highlight his in yellow:

    Please Login or Register  to view this content.
    Seems to me that the problem is with the last line, which is strange since without the waiting code it works totally fine.

  4. #4
    Forum Guru MarvinP's Avatar
    Join Date
    07-23-2010
    Location
    Woodinville, WA
    MS-Off Ver
    Office 365
    Posts
    16,169

    Re: Waiting command to refresh pivot table

    I think you need to move the errant line to a Module instead of having it behind a worksheet. It is a matter of scope.

    Look at http://www.ozgrid.com/VBA/variable-scope-lifetime.htm or
    http://www.cpearson.com/Excel/Scope.aspx

  5. #5
    Registered User
    Join Date
    01-10-2013
    Location
    Australia
    MS-Off Ver
    Excel 2010
    Posts
    37

    Re: Waiting command to refresh pivot table

    Thanks, I will take a look.

+ 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. Replies: 0
    Last Post: 08-20-2013, 10:08 AM
  2. Replies: 0
    Last Post: 08-14-2013, 06:31 AM
  3. [SOLVED] Using VBA to change a pivot table filter, refresh the report and set up a refresh delay
    By Bonnister in forum Excel Programming / VBA / Macros
    Replies: 8
    Last Post: 06-18-2012, 10:43 AM
  4. Replies: 2
    Last Post: 10-25-2010, 11:31 AM
  5. import data from access table to excel pivot table - Enable Auto Refresh
    By okl in forum Excel Programming / VBA / Macros
    Replies: 16
    Last Post: 02-01-2010, 09:38 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