Solved

Excel Substitute or Find and Replace or Macro Solution

Posted on 2011-09-06
5
260 Views
Last Modified: 2012-05-12
I have a rather large spread sheet where I would like to have Excel find specific words in the sheet (among thousands of sentences) and replace them with my chosen words.  I use the Substitute Function but it only has up to 8 words I can substitute (find and replace) – I would like to have the ability to seek and replace 20-50 words at a time.   I am trying to figure out a way I can run this in a macro (or other solution).  
Book2.xlsx
0
Comment
Question by:mmmcdee
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 3
  • 2
5 Comments
 
LVL 24

Expert Comment

by:StephenJR
ID: 36491420
Well code could loop through a series of words, or regular expressions perhaps. Are all the words being replaced by the same word or different ones?
0
 

Author Comment

by:mmmcdee
ID: 36491443
Different Words. Replacing words within sentences.  I created a sample attached sheet.
0
 

Author Comment

by:mmmcdee
ID: 36491527
Correction:  All of the words are being replaced by the same word.
0
 
LVL 24

Accepted Solution

by:
StephenJR earned 500 total points
ID: 36491837
Yes, thank you.
Sub x()

Dim oRgx As Object, rCell As Range, v, w

Set oRgx = CreateObject("VBScript.RegExp")

v = Range("D6:D14")
w = Join(Application.Transpose(v), "|")

With oRgx
    .Global = True
    .Pattern = w
    For Each rCell In Range("B6", Range("B6").End(xlDown))
        rCell.Offset(, 5) = .Replace(rCell, Range("D4").Value)
    Next rCell
End With

End Sub

Open in new window

0
 

Author Closing Comment

by:mmmcdee
ID: 36492345
Awesome Job
0

Featured Post

Revamp Your Training Process

Drastically shorten your training time with WalkMe's advanced online training solution that Guides your trainees to action.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Introduction This Article briefly covers methods of calculating the NPV and IRR variants in Excel as well as the limitations in calculating and interpreting IRR results. Paraphrasing Richard Shockley, author of my favourite finance reference tex…
Freeze panes is an option within all variants of Excel to enable parts of a sheet to remain stationary when the cursor is in another part of the sheet. This is a very useful feature which is overlooked or under used.
This Micro Tutorial will demonstrate the scrolling table in Microsoft Excel using the INDEX function.
This Micro Tutorial demonstrates in Microsoft Excel how to consolidate your marketing data by creating an interactive charts using form controls. This creates cool drop-downs for viewers of your chart to choose from.

726 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question