Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 4
Default Find and replace a character in a cell with another cell's content

Hello, I have several strings of characters in column "A" and, a list of
special characters in column "B" and a list of replacement characters in
column "C". I would like to create a macro that copies B1 content, then look
for it in all column "A" cells and replace it with C1 content, then will copy
B2 content, look for it in column "A" and replace it with C2 content...and so
on until next cell in "B" column is blank. I tried an iterative function, but
it is not working as I expected. any and all help would be highly appreciated!
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 8,520
Default Find and replace a character in a cell with another cell's content

Try the below which will replace cell contents...referring to ColB/C..
Please note that the replacement is for entire cell contents and not
characters within the cell...

Sub FindandReplaceComplexMultiples()

Dim intTemp As Integer, arrFindReplace As Variant
arrFindReplace = ActiveSheet.Range("B1:C" & _
ActiveSheet.Cells(Rows.Count, "B").End(xlUp).Row)

For intTemp = 1 To UBound(arrFindReplace)
If Trim(arrFindReplace(intTemp, 1)) < "" Then
Columns(1).Replace What:=arrFindReplace(intTemp, 1), _
Replacement:=arrFindReplace(intTemp, 2), _
LookAt:=xlWhole, SearchOrder:=xlByRows
End If
Next

End Sub

If this post helps click Yes
---------------
Jacob Skaria


"JABAgdl" wrote:

Hello, I have several strings of characters in column "A" and, a list of
special characters in column "B" and a list of replacement characters in
column "C". I would like to create a macro that copies B1 content, then look
for it in all column "A" cells and replace it with C1 content, then will copy
B2 content, look for it in column "A" and replace it with C2 content...and so
on until next cell in "B" column is blank. I tried an iterative function, but
it is not working as I expected. any and all help would be highly appreciated!

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
Find a cell's content in another cell but only as whole word(s) Paul Excel Worksheet Functions 2 February 5th 09 10:41 AM
how to find and replace content of a specific cell based on its ad IVUSKA Excel Discussion (Misc queries) 4 November 5th 08 04:13 PM
How to Find/Replace * (asterisk) in cell content Topmark Excel Discussion (Misc queries) 4 October 23rd 08 05:49 PM
find replace the 1st character in a cell Pete Excel Discussion (Misc queries) 2 March 31st 08 07:27 AM
how do i find and replace a portion of a cell's formula? KyWilde Excel Discussion (Misc queries) 2 November 3rd 06 03:49 AM


All times are GMT +1. The time now is 07:26 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"