+ Reply to Thread
Results 1 to 5 of 5

Find / Replace with Multiple Values

  1. #1
    Registered User
    Join Date
    04-18-2011
    Location
    Bucharest, Romania
    MS-Off Ver
    Excel 2019
    Posts
    90

    Find / Replace with Multiple Values

    Hi guys,

    I need to be able to find/replace multiple values in a spreadsheet. So:

    - one sheet contains the values i need to search for and their replacement ("Sheet2")
    - the other contains the data that needs to be changed

    Here is the macro that i have :

    Please Login or Register  to view this content.

    The problem I'm having is that the macro is not replacing correctly all the data. For the first 3 digit data (until Row 687) it works fine but when the 4 digit data comes, errors start to appear (I colored the cells to be more obvious ).

    If I run the macro, only for the 4 digit data (by deleting the find/replace data for the 3 digit) then it works fine.

    I also tried making 2 separate macros for the 3 and 4 digit data and calling them from a main macro, but I still get errors.

    Thanks for any suggestions.
    Last edited by ciprian; 04-29-2011 at 02:19 AM.

  2. #2
    Registered User
    Join Date
    04-18-2011
    Location
    Bucharest, Romania
    MS-Off Ver
    Excel 2019
    Posts
    90

    Re: Find / Replace with Multiple Values

    This the attachment that should have been available in the first post
    Attached Files Attached Files

  3. #3
    Forum Moderator Leith Ross's Avatar
    Join Date
    01-15-2005
    Location
    San Francisco, Ca
    MS-Off Ver
    2000, 2003, & 2010
    Posts
    23,258

    Re: Find / Replace with Multiple Values

    Hello ciprian,

    Welcome to the Forum!

    I rewrote your macro using a different method that is faster. This method also corrects the problem you were having. This macro dynamically adjusts for the find and replace values as well as the raw data.
    Please Login or Register  to view this content.
    Sincerely,
    Leith Ross

    Remember To Do the Following....

    1. Use code tags. Place [CODE] before the first line of code and [/CODE] after the last line of code.
    2. Thank those who have helped you by clicking the Star below the post.
    3. Please mark your post [SOLVED] if it has been answered satisfactorily.


    Old Scottish Proverb...
    Luathaid gu deanamh maille! (Rushing causes delays!)

  4. #4
    Registered User
    Join Date
    04-18-2011
    Location
    Bucharest, Romania
    MS-Off Ver
    Excel 2019
    Posts
    90

    Re: Find / Replace with Multiple Values

    Thank you for the code, it is great and way faster then what i had before. I made some changes so that it will change the value in the actual cell and also extended the find and replace to include the second column

    Please Login or Register  to view this content.
    Last edited by ciprian; 04-29-2011 at 02:25 AM.

  5. #5
    Forum Moderator Leith Ross's Avatar
    Join Date
    01-15-2005
    Location
    San Francisco, Ca
    MS-Off Ver
    2000, 2003, & 2010
    Posts
    23,258

    Re: Find / Replace with Multiple Values

    Hello ciprian,

    Good job on changing the code! You don't need the Offset(0, 0). You can do this way also...
    Please Login or Register  to view this content.

+ 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