+ Reply to Thread
Results 1 to 6 of 6

Help improving a VBA that Find And Replaces Multiple Text Strings Within A Text String

  1. #1
    Registered User
    Join Date
    05-15-2009
    Location
    Cambridge
    MS-Off Ver
    Excel 2003
    Posts
    23

    Help improving a VBA that Find And Replaces Multiple Text Strings Within A Text String

    So I have the following VBA which allows me to use the formula =REPLACETEXTS(A2,$A$6:$A$9,$B$6:$B$9) to find and replace words in text strings with words in a list.

    The issue is that it is case sensitive and if the word i'm looking for eg "apple" doesn't have a space between it and the previous word eg "NOapple"

    eventually I need to use this for find replace list of over 1000 names!

    I've attached an example and highlighted where it goes wrong in red
    Attached Files Attached Files

  2. #2
    Forum Expert millz's Avatar
    Join Date
    08-14-2013
    Location
    Singapore
    MS-Off Ver
    Excel, Access 2016
    Posts
    1,694

    Re: Help improving a VBA that Find And Replaces Multiple Text Strings Within A Text String

    Added this line right above your code it ignores cases:
    Please Login or Register  to view this content.
    If you want it to also replace "Johnsmith" for "John smith"->"[Test 2]", you may need a different approach. Maybe removing spaces.
    多么想要告诉你 我好喜欢你

  3. #3
    Registered User
    Join Date
    05-15-2009
    Location
    Cambridge
    MS-Off Ver
    Excel 2003
    Posts
    23

    Re: Help improving a VBA that Find And Replaces Multiple Text Strings Within A Text String

    I am looking to replace "John Smith" NOT "Johnsmith".

    The issues are is the name appears as "john smith" (No capitals) and "other nameJohn Smith" ( no space before John)

  4. #4
    Registered User
    Join Date
    05-15-2009
    Location
    Cambridge
    MS-Off Ver
    Excel 2003
    Posts
    23

    Re: Help improving a VBA that Find And Replaces Multiple Text Strings Within A Text String

    Not sure I understand what you have changed?

  5. #5
    Forum Expert millz's Avatar
    Join Date
    08-14-2013
    Location
    Singapore
    MS-Off Ver
    Excel, Access 2016
    Posts
    1,694

    Re: Help improving a VBA that Find And Replaces Multiple Text Strings Within A Text String

    I didn't change anything, just add a line above your code.

    https://docs.microsoft.com/en-us/dot...pare-statement

  6. #6
    Registered User
    Join Date
    05-15-2009
    Location
    Cambridge
    MS-Off Ver
    Excel 2003
    Posts
    23

    Re: Help improving a VBA that Find And Replaces Multiple Text Strings Within A Text String

    sorry I see that now. Will this now also ignore accents?!

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. [SOLVED] Loop with finding text strings in List1 and find in List2 text strings.
    By Grahamfeeley in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 11-06-2020, 11:43 AM
  2. [SOLVED] Find Multiple Text Strings in Column, return the 9 cell strings below
    By BoExcels in forum Excel Formulas & Functions
    Replies: 2
    Last Post: 11-05-2019, 09:56 AM
  3. Replies: 9
    Last Post: 03-09-2015, 10:15 PM
  4. Formula to find and return text string within a cell full of text strings
    By LightingPop in forum Excel Formulas & Functions
    Replies: 3
    Last Post: 12-03-2013, 11:45 PM
  5. [SOLVED] Find partial text string within another text string return original text into cell.
    By mikey42979 in forum Excel Formulas & Functions
    Replies: 9
    Last Post: 06-17-2013, 02:58 PM
  6. Replies: 6
    Last Post: 03-08-2012, 10:35 AM
  7. IF and FIND Statement for Multiple Text Strings
    By AWJ in forum Excel General
    Replies: 4
    Last Post: 11-19-2009, 10:54 PM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1