+ Reply to Thread
Results 1 to 11 of 11

Finding and replace from different sheets

  1. #1
    Registered User
    Join Date
    03-05-2013
    Location
    KSA
    MS-Off Ver
    Excel 2007
    Posts
    4

    Unhappy Finding and replace from different sheets

    HI,

    it is my first post.

    I need to have a micro to find and replace between different sheets in same workbook.
    the cells which will be replaced could be changed in location within same sheet, and number of rows not fixed (i want to search in whole sheet).

    the search could be with exact cell value but it will be better if we can search string within a cell.

    the new data are in another sheet in two columns A column contains to be replaced value and B column contains the new value. also the number of rows is changeable.

    below is a sample where sheet2 contain the old and new values
    Attached Files Attached Files

  2. #2
    Registered User
    Join Date
    03-05-2013
    Location
    KSA
    MS-Off Ver
    Excel 2007
    Posts
    4

    Re: Finding and replace from different sheets

    It is look like a difficult request.
    no one can help?

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

    Re: Finding and replace from different sheets

    Here deals with part of the problem, it does not loop through sheets, but look at two sheets. Try it
    Please Login or Register  to view this content.

  4. #4
    Registered User
    Join Date
    03-05-2013
    Location
    KSA
    MS-Off Ver
    Excel 2007
    Posts
    4

    Re: Finding and replace from different sheets

    Thank you.
    It works and really helped

  5. #5
    Forum Expert mike7952's Avatar
    Join Date
    12-17-2011
    Location
    Florida
    MS-Off Ver
    Excel 2007, Excel 2016
    Posts
    3,520

    Re: Finding and replace from different sheets

    Maybe this will work, will take a little time to run. Also on sheet 2 you need to get rid of the comma

    Please Login or Register  to view this content.
    Thanks,
    Mike

    If you are satisfied with the solution(s) provided, please mark your thread as Solved.
    Select Thread Tools-> Mark thread as Solved.

  6. #6
    Valued Forum Contributor
    Join Date
    11-15-2008
    Location
    ph
    MS-Off Ver
    2007/2010/2016
    Posts
    479

    Re: Finding and replace from different sheets

    AB33 & Mike -

    I guess the safe loop would be
    Please Login or Register  to view this content.
    otherwise, it will return incorrect results.
    Abis1 will replace all instance like Abis10,11,12,etc

    event

  7. #7
    Forum Expert mike7952's Avatar
    Join Date
    12-17-2011
    Location
    Florida
    MS-Off Ver
    Excel 2007, Excel 2016
    Posts
    3,520

    Re: Finding and replace from different sheets

    @event21

    Yea you are right. Adding a comma to the end would solve some of the issue but not if its the last value in the cell.
    aArr(i, 1) & "," would replace the first Abis1,
    Example [Abis1, Abis10]
    aArr(i, 1) & "," would miss Abis1,
    Example [Abis10, Abis1]


    Please Login or Register  to view this content.
    I guess prolly need to find all the values with a xlpart match then test for exact match

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

    Re: Finding and replace from different sheets

    Thanks Mike and events21!
    The other bit which has not being resolved is to loop through each sheets. I was wondering how you can speed up an already slow code.

  9. #9
    Valued Forum Contributor
    Join Date
    11-15-2008
    Location
    ph
    MS-Off Ver
    2007/2010/2016
    Posts
    479

    Re: Finding and replace from different sheets

    Hi -

    I think 20 secs for this purpose is not bad at all.

    event

  10. #10
    Forum Expert mike7952's Avatar
    Join Date
    12-17-2011
    Location
    Florida
    MS-Off Ver
    Excel 2007, Excel 2016
    Posts
    3,520

    Re: Finding and replace from different sheets

    Give this a try.

    Please Login or Register  to view this content.
    Last edited by mike7952; 03-10-2013 at 02:59 PM.

  11. #11
    Registered User
    Join Date
    03-05-2013
    Location
    KSA
    MS-Off Ver
    Excel 2007
    Posts
    4

    Re: Finding and replace from different sheets

    Thank you all

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

Tags for this Thread

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