Error for a replace. It replace ALL instead of selected column


M

Mathieu

Hi, I need to find a column and make a copy of it somewhere (for backup
reference). Then, for the first column (the one I copied) I need to replace a
number by a city name. The problem is that ALL of the said number in the
sheet ias replace by the city name. I thought by selecting and activate the
column it would prevent to do this, but it's not working properly. Below is
the code I use.

Thank you!



Range("A1").Select
Cells.Find(What:="Plnt", After:=ActiveCell, LookIn:=xlFormulas, LookAt:= _
xlPart, SearchOrder:=xlByRows, SearchDirection:=xlNext,
MatchCase:=False _
, SearchFormat:=False).Activate
Selection.Resize(numRows + 30000, numColumns + 1).Select
Selection.Copy
Range("A1").End(xlToRight).Select
ActiveCell.Offset(0, 1).Select
Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone,
SkipBlanks _
:=False, Transpose:=False
Cells.Find(What:="Plnt", After:=ActiveCell, LookIn:=xlFormulas, LookAt:= _
xlPart, SearchOrder:=xlByRows, SearchDirection:=xlNext,
MatchCase:=False _
, SearchFormat:=False).Activate
Selection.Resize(numRows + 30000, numColumns + 1).Select
Cells.Replace What:="2110", Replacement:="Joliette", LookAt:=xlPart, _
SearchOrder:=xlByRows, MatchCase:=False, SearchFormat:=False, _
ReplaceFormat:=False
 
Ad

Advertisements

Ad

Advertisements


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

Top