+ Reply to Thread
Results 1 to 7 of 7

How do I copy a row from one worksheet to another by looking for a character string?

  1. #1
    Registered User
    Join Date
    01-25-2012
    Location
    Addison, TX
    MS-Off Ver
    Excel 2010
    Posts
    3

    How do I copy a row from one worksheet to another by looking for a character string?

    I need to look for a character string in the cells in row A. If the cell contains "GRA" I need to copy the row to the worksheet named "A". If the cell contains "GRB" I need to copy the row to the worksheet named "B" and so on. There can be multiple strings found in one cell. I have all of my worksheets named and I do not have control over how many rows there are in any of the worksheets. I am using Excel 2010.
    Attached Files Attached Files
    Last edited by businessanalyst; 01-27-2012 at 10:15 AM.

  2. #2
    Forum Expert
    Join Date
    12-15-2009
    Location
    Chicago, IL
    MS-Off Ver
    Microsoft Office 365
    Posts
    3,177

    Re: How do I copy a row from one worksheet to another by looking for a character stri

    Because you work in the medical field, I put a little bit more effort haha... The only way I can think of is writing a macro. Take a look the file. Basically, the code is going to look at Column A row #2 to the last row. If the cell contains the key word, then it is going to copy the entire row to the destination worksheet.

    Please Login or Register  to view this content.
    Attached Files Attached Files

  3. #3
    Forum Expert JBeaucaire's Avatar
    Join Date
    03-21-2004
    Location
    Bakersfield, CA
    MS-Off Ver
    2010, 2016, Office 365
    Posts
    33,492

    Re: How do I copy a row from one worksheet to another by looking for a character stri

    JieJenn, since the column A strings may have multiple matching strings, I don't think you want to use ElseIf, I believe you want to run each test fully, the same row may copy to multiple sheets.

    Please Login or Register  to view this content.
    Last edited by JBeaucaire; 01-25-2012 at 07:24 PM.
    _________________
    Microsoft MVP 2010 - Excel
    Visit: Jerry Beaucaire's Excel Files & Macros

    If you've been given good help, use the icon below to give reputation feedback, it is appreciated.
    Always put your code between code tags. [CODE] your code here [/CODE]

    ?None of us is as good as all of us? - Ray Kroc
    ?Actually, I *am* a rocket scientist.? - JB (little ones count!)

  4. #4
    Forum Expert
    Join Date
    12-15-2009
    Location
    Chicago, IL
    MS-Off Ver
    Microsoft Office 365
    Posts
    3,177

    Re: How do I copy a row from one worksheet to another by looking for a character stri

    Good call. Thanks.

    Per JBeaucaire's suggestion

    Please Login or Register  to view this content.
    Attached Files Attached Files
    Last edited by JieJenn; 01-25-2012 at 07:27 PM.

  5. #5
    Forum Expert JBeaucaire's Avatar
    Join Date
    03-21-2004
    Location
    Bakersfield, CA
    MS-Off Ver
    2010, 2016, Office 365
    Posts
    33,492

    Re: How do I copy a row from one worksheet to another by looking for a character stri

    I took out the X and Y variables because I imagine the OP is going to add numerous "checks", no need to have a separate "variable" for each sheet individually when an OFFSET() will drop the data into the next empty row.

  6. #6
    Registered User
    Join Date
    01-25-2012
    Location
    Addison, TX
    MS-Off Ver
    Excel 2010
    Posts
    3

    Re: How do I copy a row from one worksheet to another by looking for a character stri

    I want to thank you all for your help! This worked perfectly!

  7. #7
    Forum Expert JBeaucaire's Avatar
    Join Date
    03-21-2004
    Location
    Bakersfield, CA
    MS-Off Ver
    2010, 2016, Office 365
    Posts
    33,492

    Re: How do I copy a row from one worksheet to another by looking for a character stri

    Thanks for the feedback.

    If that takes care of your need, please click 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.6.0 RC 1