+ Reply to Thread
Results 1 to 2 of 2

Thread: multiFindNReplace MACRO

  1. #1
    Registered User
    Join Date
    12-19-2011
    Location
    usa
    MS-Off Ver
    Excel 2011
    Posts
    1

    multiFindNReplace MACRO

    I need to Find & Replace based on ID#'s between two Sheets. My ID#'s are in column "A", but the data that needs to change is in column "FirstName". I've found a Macro that works except that it changes the ID# instead of the FirstName.

    Here is the code:

    Sub multiFindNReplace()
        Dim myList, myRange
        Set myList = Sheets("Sheet2").Range("A2:A3")
        Set myRange = Sheets("sheet1").Range("A2:A28")
        For Each cel In myList.Columns(1).Cells
            myRange.Replace what:=cel.Value, replacement:=cel.Offset(0, 1).Value
        Next cel
        
    End Sub
    See example image:
    example.jpg

    So, in Sheet1 the FirstName "JAMES" should change to "Jimmy", and "RONALD" should change to "Ronny" based off of finding the correct ID#.

    However, the current code changes the ID# instead.

  2. #2
    Forum Guru
    Join Date
    10-10-2008
    Location
    Northeast Pennsylvania, USA
    MS-Off Ver
    Excel 2003, 2007.
    Posts
    1,462

    Re: multiFindNReplace MACRO

    med123,

    Welcome to the Excel Forum.

    For a solution see your cross post here:
    http://www.mrexcel.com/forum/showthread.php?t=600081
    Have a great day,
    Stan
    stanleydgromjr
    Windows Vista Business, Excel 2003 and 2007

    If you are satisfied with the solution(s) provided, please mark your thread as Solved by clicking EDIT in your original post, click GO ADVANCED and set the PREFIX box to SOLVED.

+ 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.2.0