+ Reply to Thread
Results 1 to 3 of 3

Help writing a macro to find text and copy values to adjacent cells

  1. #1
    Registered User
    Join Date
    10-24-2012
    Location
    London, England
    MS-Off Ver
    Excel 2003
    Posts
    2

    Help writing a macro to find text and copy values to adjacent cells

    Hi,

    I'm a total novice when it comes to writing macros and am desperately trying to figure out a way to write code to sort out a messy database.

    Essentially, I need to search for specific text in one column and if present, copy the value from an adjacent cell (same row) and paste this value into another cell (same row, different column). This needs to be done for three specific text searches.

    For example...

    Column J needs to be searched for "E2", "LH" and "FSH".
    If "E2" is present in a cell, the value in column M needs to be copied and pasted into the corresponding cell in column N on that row.
    If "LH" is present in a cell, the value in column M needs to be copied and pasted into the corresponding cell in column O on that row.
    If "FSH" is present in a cell, the value in column M needs to be copied and pasted into the corresponding cell in column P on that row.

    Any help or advice you could give me would be greatly appreciated!
    Thanks.

  2. #2
    Registered User
    Join Date
    10-19-2012
    Location
    York
    MS-Off Ver
    Excel 2003 / 2010
    Posts
    59

    Re: Help writing a macro to find text and copy values to adjacent cells

    hi

    If your only copying the data across a simple if statement will cover it, rather than using a macro.
    you can then use the same formula for the other two comments, changing the search text, and the text

    =IF(M2="E2","E2","")

    Adi

  3. #3
    Registered User
    Join Date
    10-24-2012
    Location
    London, England
    MS-Off Ver
    Excel 2003
    Posts
    2

    Re: Help writing a macro to find text and copy values to adjacent cells

    Great. Thanks for your help!

    Nick

+ 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