Programming the Find Dialog Box

  • Thread starter Thread starter kirkm
  • Start date Start date
K

kirkm

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

Thanks - Kirk
 
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.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Similar Threads

Labell Height 1
Status Bar Message 1
Is this right? 2
Find Left$ 2
Defaults for 'Find' 2
VBA - JumpTo Specific Row 6
How can this be??? 7
Text Box - Control Source 1

Back
Top