Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
MAK MAK is offline
external usenet poster
 
Posts: 20
Default Help with Search and Replace

Hello,

I am looking for a simple method of searching through a range and replacing
target specific characters within each cell / piece of data replacing or
deleting them the old value with a new value. The key is that I want to
specify the position of the character within the cell so I do not overwrite
with the incorrect data.

Thank you very much,
Mark

  #3   Report Post  
Posted to microsoft.public.excel.programming
Ben Ben is offline
external usenet poster
 
Posts: 509
Default Help with Search and Replace

do you mean you wish to specify the postion of the character that is found or
that you are overwritting with? I would say just use specail characters to
identify EXACTLY what you want overwritten

"mak" wrote:

Hello,

I am looking for a simple method of searching through a range and replacing
target specific characters within each cell / piece of data replacing or
deleting them the old value with a new value. The key is that I want to
specify the position of the character within the cell so I do not overwrite
with the incorrect data.

Thank you very much,
Mark

  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 34
Default Help with Search and Replace

If you are looking to replace one substring for another that is the same
length, you can use the "Mid" statement. Mid lets you designate the starting
position and the length of the string you want to work with. For example, if
I wanted to replace the substring "a" with the substring "b" if "a" appeared
as the third character in the string I could use.

Dim strTest As String

strTest = ActiveCell.Formula

If Mid(strTest, 3, 1) = "a" Then
Mid(strTest, 3, 1) = "b"
ActiveCell.Formula = strTest
End If

If the length of the substrings you are finding and replacing are different
lenghts, you should look at the VBA "Replace" function (not to be confused
with the Excel Text function - REPLACE)

Stan Shoemaker
Palo Alto, CA


"mak" wrote:

Hello,

I am looking for a simple method of searching through a range and replacing
target specific characters within each cell / piece of data replacing or
deleting them the old value with a new value. The key is that I want to
specify the position of the character within the cell so I do not overwrite
with the incorrect data.

Thank you very much,
Mark

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
Search and replace CatPEG Excel Discussion (Misc queries) 4 January 7th 08 04:31 AM
Search and Replace Rebecca New Users to Excel 2 June 5th 06 06:42 AM
Search and replace rajgopal Excel Programming 1 October 1st 04 07:17 PM
Search and Replace Eric[_6_] Excel Programming 3 July 13th 04 09:44 AM
Search and Replace... Paul B[_7_] Excel Programming 0 October 1st 03 06:12 PM


All times are GMT +1. The time now is 08:03 PM.

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

About Us

"It's about Microsoft Excel"