+ Reply to Thread
Results 1 to 7 of 7

Find and replace with contents of a cell

  1. #1
    Registered User
    Join Date
    10-04-2007
    Posts
    5

    Find and replace with contents of a cell

    I want to replace a text string with constantly changing values. To do this I'd like to link a cell in the Find and Replace tool. Is this possible? Or can this be done through a macro?

  2. #2
    Forum Contributor
    Join Date
    07-07-2005
    Location
    England
    MS-Off Ver
    2003 Pro
    Posts
    452

    Re: Find and replace with contents of a cell

    Can you provide further info. Maybe a short example..

    How will Excel know what string to look for and what to replace it with?

  3. #3
    Valued Forum Contributor Shijesh Kumar's Avatar
    Join Date
    05-26-2008
    Location
    Bangalore / India
    MS-Off Ver
    2000
    Posts
    717

    Re: Find and replace with contents of a cell

    The below code find the text in cell A1 and Replaces with the text in Cell A2

    First select the range where u want find and replace and then run the macros..


    Please Login or Register  to view this content.

  4. #4
    Registered User
    Join Date
    10-04-2007
    Posts
    5

    Re: Find and replace with contents of a cell

    Shijesh. Thanks. I think this is exactly what I'm looking for.

    however, I have never done macros before, so if its not too much trouble, can you please guide me step by step what I need to do?

    Sorry to be a pain, and thanks.

  5. #5
    Valued Forum Contributor Shijesh Kumar's Avatar
    Join Date
    05-26-2008
    Location
    Bangalore / India
    MS-Off Ver
    2000
    Posts
    717

    Re: Find and replace with contents of a cell

    sure..

    Press Alt + F11 ( A white window will open ).
    Click on INSERT (MENU) ---> Module...

    Copy and paste the above code in white section..

    now come to excel spread sheet
    Click on Tool --> Macro --> Macros ( I will open a window )

    Select find_and_replace and click on run

  6. #6
    Registered User
    Join Date
    10-04-2007
    Posts
    5

    Re: Find and replace with contents of a cell

    Shijesh. Spot on! Thanks. Can I ask a couple of questions though, please?

    1.If there were upto 4 strings that needed to be replaced at a time, i.e., for eg find A1 & replace with A2, find B1 & replace with B2, etc. how can that be done

    2. If the data was on sheet1, can the macro read the find and replace cells from sheet 2?

    3. For the data to be reverted back to its original, is there an easier way that reversing the contents of cell A1 and A2 and then running the macro again?

    Thanks again, mate.

  7. #7
    Valued Forum Contributor Shijesh Kumar's Avatar
    Join Date
    05-26-2008
    Location
    Bangalore / India
    MS-Off Ver
    2000
    Posts
    717

    Re: Find and replace with contents of a cell

    Quote Originally Posted by gettingthere View Post
    1.If there were upto 4 strings that needed to be replaced at a time, i.e., for eg find A1 & replace with A2, find B1 & replace with B2, etc. how can that be done
    Yes that can be done.. below is the code for that
    Please Login or Register  to view this content.
    2. If the data was on sheet1, can the macro read the find and replace cells from sheet 2?
    Yes this too is possible. Below is the sample code...
    Please Login or Register  to view this content.
    3. For the data to be reverted back to its original, is there an easier way that reversing the contents of cell A1 and A2 and then running the macro again?

    Thanks again, mate.
    Changes done by macros is generally permanent .. so u cannot use ctrl+z to revert the changes... u can to run macros again...

+ 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