ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Programming the Find Dialog Box (https://www.excelbanter.com/excel-programming/394529-programming-find-dialog-box.html)

kirkm[_7_]

Programming the Find Dialog Box
 
Is is possible to pragrammicably set
the 'Match entire cell contents' and
'Look in:' values?

Thanks - Kirk

Bill Renaud

Programming the Find Dialog Box
 
Try this code:

Sub FindExample()
Cells.Find What:="", LookIn:=xlValues, LookAt:=xlWhole
Application.Dialogs(xlDialogFormulaFind).Show
End Sub

The first line in the subroutine sets up the Find method, but doesn't
actually find anything. You might want to save the active cell before
calling the Find method, then activate that cell again after the Find
method, to insure that the active cell doesn't move after the Find
method.
The next line of code actually displays the dialog box, which then uses
(reuses) the parameters from the previous call.

From the Help topic for the Find Method:

"The settings for LookIn, LookAt, SearchOrder, and MatchByte are saved
each time you use this method. If you don't specify values for these
arguments the next time you call the method, the saved values are used.
Setting these arguments changes the settings in the Find dialog box, and
changing the settings in the Find dialog box changes the saved values
that are used if you omit the arguments. To avoid problems, set these
arguments explicitly each time you use this method."

Also see the "Dialogs Collection Object" topic in Help.
--
Regards,
Bill Renaud





All times are GMT +1. The time now is 12:16 PM.

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