View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
Tom Ogilvy Tom Ogilvy is offline
external usenet poster
 
Posts: 6,953
Default cell.replace strange behaviour

there is apparently something wrong with the formula that you are trying to
do the replace on when it errors.

there is no other reason that I can think of that this should not work.

--
Regards,
Tom Ogilvy


"Nicawette" wrote:

Hi all,

Sub remplacement()
Sheets("Sheet2").Select
Cells.Replace What:="=", replacement:="=", LookAt:=xlPart,
SearchOrder _
:=xlByRows, MatchCase:=False
Sheets("Sheet3").Select
Cells.Replace What:="=", replacement:="=", LookAt:=xlPart,
SearchOrder _
:=xlByRows, MatchCase:=False
End Sub

I've recorded this macro to avoid hitting enter each time when I copy a
formula located in a cell in text format into a new cell (not in text
format).

When I run this macro it works fine with a formula like "=x+5" or
"=len()" but not with a formula like "=vlookup()" I have an error 1004
message saying that "replace method of range class failed".

The amazing thing is that when I have recorded this macro, it worked
fine with the =vlookup() and also worked fine when I've used the find
and replace ????

Any idea to solve it ?

Tx

Nic.