Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Launch Find and Replace with VBA

Status
Not open for further replies.

Dina01

Programmer
Mar 26, 2002
204
0
0
CA
Hello,

I was wondering if I can launch the Find & Replace command from VBA code.

I need to be able to create it in a module and then it opens up the same Find and Replace command.

Thnaks
 
Cells.Replace What:="Whatever", Replacement:="Replacetext", LookAt:=xlPart, _
SearchOrder:=xlByRows, MatchCase:=False, SearchFormat:=False, _
ReplaceFormat:=False

This will search the whole document and replace Whatever by Replacetext

dyarwood
 
Hello,

Thanks for your reply but that's not what I am looking for, I only need the code to make the Find & Replace pop screen to appear, since I don't always know what I am searching for....
 
You can do a similar thing using an input box

findtext = InputBox(Prompt:="What do you want to replace")
replacetext = InputBox(Prompt:="Enter replacement text")

Cells.Replace What:=findtext, Replacement:=replacetext, LookAt:=xlPart, _
SearchOrder:=xlByRows, MatchCase:=False, SearchFormat:=False, _
ReplaceFormat:=False

This will allow you to enter what to find and replace.

dyarwood
 
I am going to try this...Thansk again
 
Hi Dina01,

This should do it for you ..

Code:
Application.Dialogs(xlDialogFormulaReplace).Show

Enjoy,
Tony
 
Hey Tony Thank you so much that's exactly what I was looking for....
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top