Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
Query Refresh code
Try this :
Private Sub CommandButton1_Click() Dim WS As Worksheet Dim QT As QueryTable For Each WS In Worksheets 'WS.Activate No need For Each QT In WS.QueryTables QT.Refresh BackgroundQuery:=False Next 'QT Next End Sub NickHK "SthOzNewbie" wrote in message ... I know next to nothing about VB programming so please excuse any obvious errors in the following - I am trying to refresh multiple querytables using a button. I grabbed the code from another post so I may not have the full context - Private Sub CommandButton1_Click() For Each ws In Worksheets ws.Activate For Each query In ws.QueryTables query.Refresh BackgroundQuery:=False Next query Next End Sub I get an error "application defined or object defined error". What do I need to do to fix this ? TIA IK |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
How can I 'Enable Automatic Refresh' for Query Refresh by default | Setting up and Configuration of Excel | |||
Code To Refresh Query Table | Excel Discussion (Misc queries) | |||
Query Refresh-Enable Automatic Refresh Dialogue Box | Excel Discussion (Misc queries) | |||
Timing of automatic query refresh and macro pivot table refresh | Excel Programming | |||
Excel does not close from VB!! (when i refresh Refresh query with BackgroundQuery:=False) | Excel Programming |