ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Button to allow a search (https://www.excelbanter.com/excel-programming/322728-button-allow-search.html)

Fred

Button to allow a search
 
I would like to be able to click on a command button and have it pop up a
search window to type into to locate text or numbers??? I have been told that
it is impossible, but I think it can be done. Please help. Thanks

Tom Ogilvy

Button to allow a search
 
Private Sub Commandbutton1_Click()
application.Dialogs(xlDialogFormulaFind).show
End Sub


may be what you want.

--
Regards,
Tom Ogilvy

"Fred" wrote in message
...
I would like to be able to click on a command button and have it pop up a
search window to type into to locate text or numbers??? I have been told

that
it is impossible, but I think it can be done. Please help. Thanks




Fred

Button to allow a search
 
Thank you!! Works great!!

"Tom Ogilvy" wrote:

Private Sub Commandbutton1_Click()
application.Dialogs(xlDialogFormulaFind).show
End Sub


may be what you want.

--
Regards,
Tom Ogilvy

"Fred" wrote in message
...
I would like to be able to click on a command button and have it pop up a
search window to type into to locate text or numbers??? I have been told

that
it is impossible, but I think it can be done. Please help. Thanks





David

Button to allow a search
 
Tom Ogilvy wrote

Private Sub Commandbutton1_Click()
application.Dialogs(xlDialogFormulaFind).show
End Sub


Questions:
1. Is the button from the Forms or Control Toolbox?
2. How to assign a Private Sub()?
3. Will it actually find anything without a range selected?

--
David

Tom Ogilvy

Button to allow a search
 
1)
in the example, it is the click event for a commandbutton from the control
toolbox toolbar. The commandbutton's name is Commandbutton1.

2) this question is meaningless in this context. Since it is an event of
the commandbutton, it is already linked to that button. For buttons from
the forms toolbar, you would just type in the macro name in the assignment
box, even though it can't be selected from the list. Such code should be in
a general module in that case.

3) It will search within the area selected when the button is pressed. This
behavior is different from what is expected if only one cell is selected.

If a specific area is to be searched, it could be set as part of the code.

Private Sub Commandbutton1_Click()
Cells.Select
Application.Dialogs(xlDialogFormulaFind).Show
End Sub

--
Regards,
Tom Ogilvy


"David" wrote in message
...
Tom Ogilvy wrote

Private Sub Commandbutton1_Click()
application.Dialogs(xlDialogFormulaFind).show
End Sub


Questions:
1. Is the button from the Forms or Control Toolbox?
2. How to assign a Private Sub()?
3. Will it actually find anything without a range selected?

--
David





All times are GMT +1. The time now is 11:31 PM.

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