Assigning a query to a control button

S

StephanieL

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

K Dales

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).Refresh

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.
 
Top