+ Reply to Thread
Results 1 to 11 of 11

Pivot Table refresh

  1. #1
    Forum Contributor
    Join Date
    06-14-2014
    Location
    London, England
    MS-Off Ver
    2010
    Posts
    186

    Pivot Table refresh

    Hi,

    My code just seems to error out on this line of code:

    Capture.PNG

    The error message I get is

    Capture.PNG

    Can anyone please help me?

    Thanks in advance!

  2. #2
    Forum Moderator - RIP Richard Buttrey's Avatar
    Join Date
    01-14-2008
    Location
    Stockton Heath, Cheshire, UK
    MS-Off Ver
    Office 365, Excel for Windows 2010 & Excel for Mac
    Posts
    29,464

    Re: Pivot Table refresh

    Hi,

    Rather than
    .RefreshTable

    try just

    .Refresh

    Personally I prefer to use the Sheet VBA codename rather than the sheet tab name. I'm assuming the tab name you show is valid.
    Richard Buttrey

    RIP - d. 06/10/2022

    If any of the responses have helped then please consider rating them by clicking the small star icon below the post.

  3. #3
    Forum Contributor
    Join Date
    06-14-2014
    Location
    London, England
    MS-Off Ver
    2010
    Posts
    186

    Re: Pivot Table refresh

    Quote Originally Posted by Richard Buttrey View Post
    Hi,

    Rather than
    .RefreshTable

    try just

    .Refresh

    Personally I prefer to use the Sheet VBA codename rather than the sheet tab name. I'm assuming the tab name you show is valid.

    I tried using just .Refresh and now I get the following error:

    Capture.PNG

  4. #4
    Forum Expert BadlySpelledBuoy's Avatar
    Join Date
    06-14-2013
    Location
    East Sussex, UK
    MS-Off Ver
    365
    Posts
    7,468

    Re: Pivot Table refresh

    I'd say if anything were misspelled it would be the PivotTable name. If the sheet name were incorrect then the previous line would have thrown up an error, wouldn't it?

    Just tested it and if the PT name is incorrect in the VBA then I get that same error message.

    Maybe, record a macro of you refreshing the table and see what the line of code is there.

    BSB

  5. #5
    Forum Moderator - RIP Richard Buttrey's Avatar
    Join Date
    01-14-2008
    Location
    Stockton Heath, Cheshire, UK
    MS-Off Ver
    Office 365, Excel for Windows 2010 & Excel for Mac
    Posts
    29,464

    Re: Pivot Table refresh

    Quote Originally Posted by BadlySpelledBuoy View Post
    I'd say if anything were misspelled it would be the PivotTable name. If the sheet name were incorrect then the previous line would have thrown up an error, wouldn't it?



    BSB
    Indeed. Good point.

  6. #6
    Forum Expert BadlySpelledBuoy's Avatar
    Join Date
    06-14-2013
    Location
    East Sussex, UK
    MS-Off Ver
    365
    Posts
    7,468

    Re: Pivot Table refresh

    If the PivotTable name is correct in your code then may be helpful to upload the file so we can take a look.

    BSB

  7. #7
    Forum Moderator - RIP Richard Buttrey's Avatar
    Join Date
    01-14-2008
    Location
    Stockton Heath, Cheshire, UK
    MS-Off Ver
    Office 365, Excel for Windows 2010 & Excel for Mac
    Posts
    29,464

    Re: Pivot Table refresh

    Re #3.

    I'm assuming you have just one workbook open and the 'ThisWorkbook' object is therefore the same as the 'Activeworkbook'. i.e. you haven't got a line of code somewhere which has activated a second workbook.

    In that case and since w're agreed the sheet name is correct then the only other object in that line of code is the Pivot Table.

  8. #8
    Forum Contributor
    Join Date
    06-14-2014
    Location
    London, England
    MS-Off Ver
    2010
    Posts
    186

    Re: Pivot Table refresh

    its weird because since encountering the first error message, I noticed this line of code (i.e. the one that activates the sheet) no longer works.
    Its like somehow VBA has lost connection with the spreadsheet - which is quite strange because this same piece of code sometimes odes work but fails at a more later stage with an error message saying "object lost connection with its clients".

    Attachment 660369

  9. #9
    Forum Contributor
    Join Date
    06-14-2014
    Location
    London, England
    MS-Off Ver
    2010
    Posts
    186

    Re: Pivot Table refresh

    its frustrating I cannot upload my file cos its too large.
    I tried sending it as a zip but still complaining its too large.

  10. #10
    Forum Contributor
    Join Date
    06-14-2014
    Location
    London, England
    MS-Off Ver
    2010
    Posts
    186

    Re: Pivot Table refresh

    does anyone know of a way so that I can get my file checked out please?

  11. #11
    Forum Contributor
    Join Date
    06-14-2014
    Location
    London, England
    MS-Off Ver
    2010
    Posts
    186

    Re: Pivot Table refresh

    i closed the workbook, reopened it and now that line worked fine without any issues.
    This is strange.
    Has anyone experienced anything of this sort?

+ 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: 6
    Last Post: 02-23-2024, 02:11 PM
  2. VBA to create dynamic table/pivot table to auto refresh charts on other sheets
    By jamesbutler2021 in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 06-12-2019, 09:27 AM
  3. Replies: 0
    Last Post: 08-14-2013, 06:31 AM
  4. [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
  5. Replies: 2
    Last Post: 10-25-2010, 11:31 AM
  6. 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
  7. Replies: 5
    Last Post: 11-24-2005, 11:15 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