Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 26
Default Error for a replace. It replace ALL instead of selected column

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
--
Mathieu
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 105
Default Error for a replace. It replace ALL instead of selected column

HI,
Use :
Selection.Replace
instead of
Cells.Replace
Regards.
Daniel

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



  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 26
Default Error for a replace. It replace ALL instead of selected column

Thank you!
--
Mathieu


"Daniel.C" wrote:

HI,
Use :
Selection.Replace
instead of
Cells.Replace
Regards.
Daniel

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




Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
How do I find/replace data in selected cells only Mike_3333 Excel Worksheet Functions 7 April 3rd 23 07:45 PM
Copy and replace xlsm files, but retain the values in selected cells... ARbitOUR Excel Discussion (Misc queries) 1 April 24th 09 04:21 PM
Can I replace a ' at the beginning of a text cell using Replace Hilde Excel Discussion (Misc queries) 4 September 10th 07 06:22 PM
Replace fuction replacing all instead of selected cells mcphc Excel Programming 1 June 29th 06 05:31 PM
find and replace - replace data in rows to separated by commas msdker Excel Worksheet Functions 1 April 15th 06 01:00 AM


All times are GMT +1. The time now is 06:11 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"