Pulling up the Find and Replace Dialog via Code

  • Thread starter Thread starter kraljb
  • Start date Start date
K

kraljb

I have a macro that currently uses the Ctrl-F function, however when the
Macro is unuseable (or going to error out) I would prefer to have the
macro call the Find and Replace Dialog Box. The only hitch is that I
cannot seem to find that dialog box in the list of presets.

Thanks in advance for your help,
John
 
For the Find Dialog:

Dim WhatToFind As String
WhatToFind = "asdf"
Application.Dialogs(xlDialogFormulaFind).Show arg1:=WhatToFind

For the Replace dialog

Dim WhatToFind As String
Dim ChangeToWhat As String
WhatToFind = "asdf"
ChangeToWhat = "qwer"
Application.Dialogs(xlDialogFormulaReplace).Show _
arg1:=WhatToFind, arg2:=ChangeToWhat
 

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

Back
Top