Results 1 to 3 of 3

QueryTable Error

Threaded View

dfaunce83 QueryTable Error 03-07-2012, 12:39 PM
dfaunce83 Re: QueryTable Error 03-07-2012, 01:32 PM
OnErrorGoto0 Re: QueryTable Error 03-07-2012, 01:46 PM
  1. #1
    Registered User
    Join Date
    02-20-2012
    Location
    Texas
    MS-Off Ver
    Excel 2010
    Posts
    8

    QueryTable Error

    This is a snippet of code that is bothering me. I have Query Tables and Pivot Tables. I'm trying to refresh the query tables first, and then refresh the pivot tables because the pivot tables pull data from the query tables.

    I keep receiving this error: "Run-Time Error 91: Object Variable or With Variable Not Set"

    Debug points to the last line of this code snippet.

    Private Sub CommandButton2_Click()
        Worksheets("MAS (Sales Lines)").Select
        Selection.ListObject.QueryTable.Refresh BackgroundQuery:=False
        Worksheets("MAS (GL Acct)").Select
        Selection.ListObject.QueryTable.Refresh BackgroundQuery:=False
    End Sub
    Any help is appreciated!

    -David
    Last edited by dfaunce83; 03-09-2012 at 12:38 PM.

Thread Information

Users Browsing this Thread

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

Tags for this Thread

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