controlling the Range.Replace method.

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

Thanks in advance,

I have a problem when ttrying to use the range.replace method in excel. If I
have left the find/replace environment in "within" "Workbook" mode and run my
VBA code. The routine will update the entire workbook instead of the selected
range as I would expect.

Is ther a way in VBA to reset the "within" setting to "sheet" prior to
executing the Replace method?

Also, can anyone give a quick explination to Searchformat & ReplaceFormat
parameters to this function. I can only find examples where they are set to
false. And the Microsoft documentation is not very helpful.
 
Thank you Tim. I never payed attention to the formatting FIND options. I will
have to consider if these options will be helpful.

I really need an answer to the first part. It is a real problem for the
solution I am designing.

--
Tom Casey
Project Supervisor
sanofi-aventis


Tim Williams said:
Resetting the search scope:
http://groups.google.com/group/micr...+workbook+sheet&rnum=4&hl=en#576082458637e4e6

For the formattting options, recording a macro while searching using
formatting will give you a good idea of the syntax.

Eg:

Application.FindFormat.Clear
With Application.FindFormat.Interior
.ColorIndex = 6
.Pattern = xlSolid
.PatternColorIndex = xlAutomatic
End With


Tim
 
T-Casey said:
Thank you Tim. I never payed attention to the formatting FIND options. I
will
have to consider if these options will be helpful.

I really need an answer to the first part. It is a real problem for the
solution I am designing.

Tom,

The solution in the link I included (from PeterT) didn't work for you ?
Here's the relvant part:

******************
I always reset it -

On Error Resume Next
Set r = Cells.Find(What:="", _
LookIn:=xlFormulas, _
SearchOrder:=xlRows, _
LookAt:=xlPart, _
MatchCase:=False)
On Error GoTo 0
******************


Tim

 
sorry for the delay, but ...

Thank you Tim. This is the solution to my problem
 

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