ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Activating A Query from An Input Box (https://www.excelbanter.com/excel-programming/280153-activating-query-input-box.html)

-JB-[_15_]

Activating A Query from An Input Box
 
Hi, and thanks in advance for any help....

This is for an Excel 2000 macro. I have a query input box where the
user can type in a query. I have a macro that will run that query, but
I don't know how to let the user activate it.

I want the user to be able to activate the query macro in either of two
ways:
By typing in the input box and pressing Enter, or by clicking on the
"Find" button next to the input box. The Input Box is simply merged
cells in the worksheet (cell G9 on the "UserPage"), not a pop up box.

I have no idea how to make the Enter key active the query macro, and
I'm having trouble getting the button to activate it. The Excel help
file says this (to run a macro from a button):
"Right-click a selection handle for the button or graphic control, and
then click Assign Macro on the shortcut menu.".
The problem is that option doesn't exist in the shortcut menu.

Any help would be greatly appreciated.

Jim



------------------------------------------------
~~ Message posted from http://www.ExcelTip.com/
~~ View and post usenet messages directly from http://www.ExcelForum.com/


Chong Moua[_2_]

Activating A Query from An Input Box
 
You need to use events.

For Enter:

Private Sub Worksheet_Change(ByVal Target As Range)
If Target.Address = Range("G9").Address Then
'code here...
End If
End Sub

For Find button:

Private Sub Find_Click()
'code here...
End Sub

Either one of these will need to be placed on the Sheet
Code. Hope this helps...

Chong Moua

-----Original Message-----
Hi, and thanks in advance for any help....

This is for an Excel 2000 macro. I have a query input box

where the
user can type in a query. I have a macro that will run

that query, but
I don't know how to let the user activate it.

I want the user to be able to activate the query macro in

either of two
ways:
By typing in the input box and pressing Enter, or by

clicking on the
"Find" button next to the input box. The Input Box is

simply merged
cells in the worksheet (cell G9 on the "UserPage"), not a

pop up box.

I have no idea how to make the Enter key active the query

macro, and
I'm having trouble getting the button to activate it. The

Excel help
file says this (to run a macro from a button):
"Right-click a selection handle for the button or graphic

control, and
then click Assign Macro on the shortcut menu.".
The problem is that option doesn't exist in the shortcut

menu.

Any help would be greatly appreciated.

Jim



------------------------------------------------
~~ Message posted from http://www.ExcelTip.com/
~~ View and post usenet messages directly from

http://www.ExcelForum.com/

.



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

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