replace part of content in a cell
hi. i have line of words in every cell. i want replace for example one of the words in cells(1,1) with another word there is in sheet2!cells(1,2) if InStr(Cells(1, 1), Sheet2!Cells(1, 1))<> 0.
example:
Cells(1, 1)=book door bag
Sheet2!Cells(1, 1)=door
sheet2!cells(1,2)="2"
result:Cells(1, 1)=book 2 bag
now what is wrong with this code?
.
.
If Sheet2!Cells(1, 2) <> "" And InStr(Cells(1, 1), Sheet2!Cells(1, 1)) <> 0 Then
Selection.Replace What:=Cells(1, 1), Replacement:=Sheet2!Cells(1, 2))
LookAt:=xlPart, SearchOrder:=xlByRows, MatchCase:=False,
end if
.
.