+ Reply to Thread
Results 1 to 5 of 5

Find and replace only whole words (loop)

  1. #1
    Registered User
    Join Date
    11-27-2008
    Location
    Mumbai, India
    Posts
    3

    Find and replace only whole words (loop)

    Hi All

    I am trying to find any word from selected range in my sheet 1 and replace it with another word from a list saved in Master Sheet (Column A - match and Column B- Replace). I found the below code on the net and it works fine, however it replaces even if the word is a part match, which I would like to avoid

    For eg :
    1. "Narrow" - Correctly Replaces with "Wide"
    2. "Narrow Road" - Incorrectly Replaces with "Wide Road" (even if this is not a part of my replacement "Master" Sheet.)


    Please Login or Register  to view this content.

    Thanks,
    Attached Files Attached Files
    Last edited by dannel; 11-26-2018 at 04:19 PM. Reason: added a new file with more examples

  2. #2
    Forum Guru
    Join Date
    03-02-2006
    Location
    Los Angeles, Ca
    MS-Off Ver
    Win10/MSO2016
    Posts
    13,000

    Re: Find and replace only whole words (loop)

    Your sample file is inadequate. You need samples of occurrences to replace as well as those which will not be replaced.
    Ben Van Johnson

  3. #3
    Registered User
    Join Date
    11-27-2008
    Location
    Mumbai, India
    Posts
    3

    Re: Find and replace only whole words (loop)

    Thanks for your suggestion. attached a new file with more examples.

  4. #4
    Forum Expert
    Join Date
    03-28-2012
    Location
    TBA
    MS-Off Ver
    Office 365
    Posts
    12,454

    Re: Find and replace only whole words (loop)

    The default match is xlpart, so you need to change it into a whole

    Please Login or Register  to view this content.

  5. #5
    Registered User
    Join Date
    11-27-2008
    Location
    Mumbai, India
    Posts
    3

    Re: Find and replace only whole words (loop)

    thank you so much. It works !!!

+ 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] Find and Replace Loop + a Loop to remove Duplicate values
    By lougs7 in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 08-23-2018, 07:43 AM
  2. Find and Replace Loop does not find all and loop properly
    By mattyfaz in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 07-22-2015, 02:15 AM
  3. Find and Replace in Bulk for Several Words
    By Hylion in forum Excel Programming / VBA / Macros
    Replies: 9
    Last Post: 01-16-2015, 10:48 AM
  4. Replies: 3
    Last Post: 11-25-2014, 06:08 AM
  5. [SOLVED] Find and replace words with a wildcard
    By boomboomblock in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 07-04-2013, 09:58 AM
  6. [SOLVED] Find and replace multiple words
    By bumbar in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 03-09-2013, 04:28 AM
  7. Replies: 4
    Last Post: 04-27-2012, 06:38 AM

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