+ Reply to Thread
Results 1 to 2 of 2

Find and Replace dynamically

  1. #1
    Registered User
    Join Date
    06-14-2012
    Location
    Virginia, USA
    MS-Off Ver
    Excel 2010
    Posts
    3

    Find and Replace dynamically

    Hi,
    I am having trouble trying to Find and Replace info based on Cell content, rather than static content.

    In other words, I am trying to write a macro that can find cell content and replace it with another cells content.

    Example:

    Cell A2 = I like Johnny
    Cell A3 = I like Johnny, Susie, and Anna.
    Cell A4 = Timmy

    I would like to write a macro (VBA code) that can look at the content in cell A2.
    Find that same content in cell A3 that matches the content in cell A2.
    Replace the content in cell A3 with the content in cell A4.

    Results of cell A3, using example above would be: Timmy, Susie, and Anna.

    Can this be done? I have tried every possible Excel formula, macro recording and VBA code that I know and none of it worked.

    Thanks,
    GYJ

  2. #2
    Administrator FDibbins's Avatar
    Join Date
    12-29-2011
    Location
    Duncansville, PA USA
    MS-Off Ver
    Excel 7/10/13/16/365 (PC ver 2310)
    Posts
    52,929

    Re: Find and Replace dynamically

    VBA will probably give you what you need, but this formula will give you the same thing. however, you cant use it in A3, because it uses that cell as a reference...

    =SUBSTITUTE(A3,A2,A4)
    1. Use code tags for VBA. [code] Your Code [/code] (or use the # button)
    2. If your question is resolved, mark it SOLVED using the thread tools
    3. Click on the star if you think someone helped you

    Regards
    Ford

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

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