LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Help with search and Replace


I needed to search a cell for "CR" and change it to "Crescent". Problem
was if the the cell contained "Crestlawn CR" it would change it to
"CRESCENTestlawn CRESCENT". I found away around it by adding my name
"malcolmbrown" to the end of each cell and then searching for
CRMALCOLMBROWN". IT works but there has to be a better way.

here is part of my routine so far

'Loops adding MALCOLMBROWN at the end of each address
Range("A1").Select
Dim p As Integer
intRowCount = Range("A1").CurrentRegion.Rows.Count
For p = 1 To intRowCount
'Adds MALCOLMBROWN onto the end of the address
ActiveCell.Offset(0, 1).Value = ActiveCell.Offset(0,
1).Value & "MALCOLMBROWN"
ActiveCell.Offset(1, 0).Select
Next p
'Replaces CRMALCOLMBROWN with crescent and deletes
MALCOLMBROWN
Columns("B:B").Select
Selection.Replace What:="CRMALCOLMBROWN",
Replacement:="CRESCENT", LookAt _
:=xlPart, SearchOrder:=xlByRows, MatchCase:=False
Selection.Replace What:="MALCOLMBROWN", Replacement:="",
LookAt:=xlPart, _
SearchOrder:=xlByRows, MatchCase:=False


--
icdoo
------------------------------------------------------------------------
icdoo's Profile: http://www.excelforum.com/member.php...o&userid=27342
View this thread: http://www.excelforum.com/showthread...hreadid=468512

 
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
search and replace Timo Excel Discussion (Misc queries) 1 August 25th 09 06:06 PM
Search and Replace help hodeware Excel Programming 1 April 1st 05 01:45 AM
Search and replace This Guy Excel Worksheet Functions 0 January 5th 05 06:02 PM
search & replace Joe Excel Worksheet Functions 0 November 9th 04 02:55 PM
Search and Replace... Paul B[_7_] Excel Programming 0 October 1st 03 06:12 PM


All times are GMT +1. The time now is 01:32 AM.

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"