ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Assigning a query to a control button (https://www.excelbanter.com/excel-programming/291559-assigning-query-control-button.html)

StephanieL

Assigning a query to a control button
 
Is there a way to assign a control button to a query --so that a user can click the button to make the query run rather than going thru the menus to find the query.

and... another issue Im having, can I run a query on a spreadsheet I have open?

K Dales

Assigning a query to a control button
 
Assuming you mean a pre-defined query that is already set
up within the workbook, refreshing it is quite simple -
add a command button and use code like this:

Sheets(WorksheetName).QueryTables(QueryName).Refre sh

QueryName would be the name given to the query table
range - i.e. right click somewhere in the query range and
choose "Data Range Properties", you will see the name in
there.

As for the second question, don't know...

-----Original Message-----
Is there a way to assign a control button to a query --so

that a user can click the button to make the query run
rather than going thru the menus to find the query.

and... another issue Im having, can I run a query on a

spreadsheet I have open?
.



All times are GMT +1. The time now is 05:50 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com