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
Bookmarks