Thanks Thanks:  0
Likes Likes:  0
Results 1 to 3 of 3

Thread: VBA Code to refresh Query Table

  1. #1
    Board Regular thelostscott's Avatar
    Join Date
    May 2010
    Posts
    226
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Default VBA Code to refresh Query Table

    Hi all,

    I have written some code that when a button is selected will Refresh a Data Query Table and all of it's information. However, I seem to be getting issues, can some one point me in the right direction with the code?

    Code:
     
    .Sheets("Sheet 1").ListObject.QueryTable.Refresh BackgroundQuery:=False
    When I recorded myslef doing this process it looked like this:

    Code:
     
    Sheets("Sheet 1").Select
    Range("D70872").Select
    Selection.ListObject.QueryTable.Refresh BackgroundQuery:=False
    Many thanks!
    Thanks for your help - I'll get there someday!
    - Operating Excel '13 -

  2. #2
    MrExcel MVP
    Moderator
    Andrew Poulsom's Avatar
    Join Date
    Jul 2002
    Posts
    73,092
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    1 Thread(s)

    Default Re: VBA Code to refresh Query Table

    Maybe try:

    Code:
    .Sheets("Sheet 1").Range("D70872").ListObject.QueryTable.Refresh BackgroundQuery:=False
    Microsoft MVP - Excel

  3. #3
    Board Regular thelostscott's Avatar
    Join Date
    May 2010
    Posts
    226
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Default Re: VBA Code to refresh Query Table

    That seemed to do it.... With a Pivot Table refresh you can just add the PivotTable Name to the code and it will Refresh from there but not the same with a Table?

    Thanks!
    Thanks for your help - I'll get there someday!
    - Operating Excel '13 -

Some videos you may like

User Tag List

Like this thread? Share it with others

Like this thread? Share it with others

Posting Permissions

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