Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
Refresh Multiple Queries via a Command Button
Hello,
I have at least two queries in my workbook that I would like to auto refresh via a Command Button. Can anyone provide a method to do this? Thank you David Morrison |
#2
Posted to microsoft.public.excel.programming
|
|||
|
|||
Refresh Multiple Queries via a Command Button
If they're QueryTables you can try something like this:
Private Sub CommandButton1_Click() Sheet1.QueryTables(1).Refresh End Sub this assumes that the object name of the worksheet is Sheet1 in the Project Explorer window (in the VB Editor, use CTRL-R to show it!) and the commandbutton is named CommandButton1 then you can extend the code to refresh all the tables together like this: dim qTab as querytable for each qtab in activesheet.querytables qtab.refresh next I hope that helps Philip "Dmorri254" wrote: Hello, I have at least two queries in my workbook that I would like to auto refresh via a Command Button. Can anyone provide a method to do this? Thank you David Morrison |
#3
Posted to microsoft.public.excel.programming
|
|||
|
|||
Refresh Multiple Queries via a Command Button
the concept of autorefresh and with a commandbutton are not really
consistent unless you mean you want to set it to autorefresh by clickking a commandbutton. Assuming you just want to have them refresh when the button is clicked. Private CommandButton1_Click() Worksheets("Sheet3").QueryTables(1).Refresh Backgroundquery:=False Worksheets("Sheet5").QueryTables(1).Refresh Backgroundquery:=False End sub -- Regards, Tom Ogilvy "Dmorri254" wrote in message ... Hello, I have at least two queries in my workbook that I would like to auto refresh via a Command Button. Can anyone provide a method to do this? Thank you David Morrison |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
set up a command button to print multiple workbook | Excel Discussion (Misc queries) | |||
copy the command button and macro for multiple rows | Excel Discussion (Misc queries) | |||
Command Button to make multiple duplicate worksheets | Excel Worksheet Functions | |||
Create refresh button in worksheet to refresh Pivot Table Data | Excel Worksheet Functions | |||
I cannot refresh all of the queries in my spreadsheet | Excel Discussion (Misc queries) |