Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
DiscussionsAccessExcelInfoPathOutlookPowerPointPublisherWord
DirectoryUser Groups
Related Topics
Outlook ExpressInternet ExplorerWindowsMS Server ProductsMore Topics ...

MS Office Forum / Excel / Worksheet Functions / March 2008

Tip: Looking for answers? Try searching our database.

find and replace

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
ant1983 - 04 Mar 2008 09:26 GMT
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!
Billy Liddel - 04 Mar 2008 11:55 GMT
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

> I'm sure this can be done so pls assist...
>
[quoted text clipped - 7 lines]
>
> Please help!
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.