d2jsp
Log InRegister
d2jsp Forums > Off-Topic > General Chat > Homework Help > Excel Help > Search And Replace
Add Reply New Topic New Poll
Member
Posts: 28,617
Joined: Aug 24 2005
Gold: 10,230.00
Nov 29 2013 03:20am
Hello!

I have a large table in which I want to replace some words. These words, and what I want them to be changed to, are in a separate table. Is it possible to ask excel to replace the words automatically, using the seperate table?
Member
Posts: 15,206
Joined: Apr 11 2010
Gold: 6,287.29
Nov 29 2013 05:09am
I'm assuming its more complicated than just copy paste lol
Member
Posts: 577
Joined: Feb 23 2012
Gold: 0.00
Nov 29 2013 02:40pm
cant u just use ctrl+f then find + replace

dunno if its just excel 2013 or if im completely wrong

This post was edited by ArnoldChlamydia on Nov 29 2013 02:40pm
Member
Posts: 10,140
Joined: Jul 10 2012
Gold: 47,863.48
Dec 1 2013 06:30pm
Did you ever get this?
Member
Posts: 28,617
Joined: Aug 24 2005
Gold: 10,230.00
Dec 2 2013 01:26am
Quote (Magicalmaged @ 29 Nov 2013 12:09)
I'm assuming its more complicated than just copy paste lol


Hehe yes. I would call that manual work ;)


Quote (ArnoldChlamydia @ 29 Nov 2013 21:40)
cant u just use ctrl+f then find + replace

dunno if its just excel 2013 or if im completely wrong


Yes this works fine for single/small amounts of replacements.


Quote (mungoflago @ 2 Dec 2013 01:30)
Did you ever get this?


Yes :D Someone in an excel help forum gave me this code. It works perfectly, when you change the targets cells E1:F5 and A1:A100.


Code

Option Explicit

Sub Replace_Values()

Dim Replacement_Table As Range
Dim Rng As Range
Dim c As Range
Dim Match As Variant

Set Replacement_Table = Range("E1:F5")
Set Rng = Range("A1:A100")

For Each c In Rng

Match = Application.Match(c.Value, WorksheetFunction.Index(Replacement_Table, 0, 1), 0)

If Not IsError(Match) Then

c = Application.VLookup(c, Replacement_Table, 2, 0)

End If

Next

End Sub
Go Back To Homework Help Topic List
Add Reply New Topic New Poll