#1   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 12
Default find and replace

I'm sure this can be done so pls assist...

I have to worksheets.

The first one has two columns: Old Label and New Label.

The 2nd worksheet has several columns and i want to do a search in a
specific column (column O). The search should be the text in the other sheet
(Old Label) and all matches should be replaced with the New Label.

Please help!
  #2   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 527
Default find and replace

AFAIK this has to be done with a macro. To avoid problems with ranges I
create Range names Old_Labels, New_Labels and Labels on the sheet you want
to update. Copy the code into a VB Module, ALT + F8, Insert Module and Paste
the code into the module. Return to the workbook and run the code. ALT + F8,
select code and click Run.

Sub test()
Set rng = Range("Labels")
Set rngOld = Range("Old_Labels")
Set rngNew = Range("New_Labels")

For Each c In rng
x = WorksheetFunction.Match(c, rngOld, 0)
If IsError(x) Then
'do nothing
Else
c.Value = WorksheetFunction.Index(rngNew, WorksheetFunction.Match(c,
rngOld, 0))
End If
Next
End Sub

Regards
Peter


"ant1983" wrote:

I'm sure this can be done so pls assist...

I have to worksheets.

The first one has two columns: Old Label and New Label.

The 2nd worksheet has several columns and i want to do a search in a
specific column (column O). The search should be the text in the other sheet
(Old Label) and all matches should be replaced with the New Label.

Please help!

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 and Replace - Replace with Blank Space Studebaker Excel Discussion (Misc queries) 4 April 3rd 23 10:55 AM
Find and Replace Ed Excel Discussion (Misc queries) 6 February 14th 07 11:00 PM
where to put results of find operation in find and replace functio DEP Excel Worksheet Functions 5 November 15th 06 07:52 PM
find and replace - replace data in rows to separated by commas msdker Excel Worksheet Functions 1 April 15th 06 01:00 AM
find replace cursor default to find box luffa Excel Discussion (Misc queries) 0 February 3rd 05 12:11 AM


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