+ Reply to Thread
Results 1 to 12 of 12

Search for content in cell from another worksheet, copy row, and pastevalue

  1. #1
    Registered User
    Join Date
    01-07-2013
    Location
    TOronto, Canada
    MS-Off Ver
    Excel 2007
    Posts
    8

    Search for content in cell from another worksheet, copy row, and pastevalue

    Hi guys, complete noob here. So thanks in advance for any help.

    I'm trying write a data search tool that does the following.

    1. I type a value into a cell, say Sheets ("search").range("c3")
    2. I run the macro
    3. Macro goes into another worksheet (call it "data") and looks for the value that I typed in Search!C3
    4. if the macro finds the value in "data", it copies the entire row and paste value into the first empty row of another worksheet (let's call it "sheet").
    5. and the macro repeats until all relevant data has been copied.


    I have no idea where to start so any help will be appreciated.

    thanks!
    Last edited by UD2; 01-07-2013 at 02:11 AM.

  2. #2
    Valued Forum Contributor
    Join Date
    02-09-2012
    Location
    Mauritius
    MS-Off Ver
    Excel 2007
    Posts
    1,055

    Re: Search for content in cell from another worksheet, copy row, and pastevalue

    Hi

    This can be done but few things not clear:
    1. the value to be searched will be in wich cell?C3 or D3?
    2. which column in sheet "data" has to be searched to copy the row?

    Upload a sample file if possible...
    Click *, if my suggestion helps you. Have a good day!!

  3. #3
    Registered User
    Join Date
    01-07-2013
    Location
    TOronto, Canada
    MS-Off Ver
    Excel 2007
    Posts
    8

    Re: Search for content in cell from another worksheet, copy row, and pastevalue

    Quote Originally Posted by jraj1106 View Post
    Hi

    This can be done but few things not clear:
    1. the value to be searched will be in wich cell?C3 or D3?
    2. which column in sheet "data" has to be searched to copy the row?

    Upload a sample file if possible...
    Thanks for the quick reply.

    My bad for the confusion, search C3. D3 was a typo.

    As for the column. I need it to search all the columns. I have some codes that will search one column only, I will post that when I get near a computer on the morning.

    Thanks!

  4. #4
    Valued Forum Contributor
    Join Date
    02-09-2012
    Location
    Mauritius
    MS-Off Ver
    Excel 2007
    Posts
    1,055

    Re: Search for content in cell from another worksheet, copy row, and pastevalue

    Okay..

    Please upload a sample file with data if possible so that I can test it with my code.

    Bye!

  5. #5
    Registered User
    Join Date
    01-07-2013
    Location
    TOronto, Canada
    MS-Off Ver
    Excel 2007
    Posts
    8

    Re: Search for content in cell from another worksheet, copy row, and pastevalue

    Here are the codes and test file. It currently looks for the data in column A. But I need it to look in every column, or at least column A:CC.

    thanks!

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

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

    Re: Search for content in cell from another worksheet, copy row, and pastevalue

    Try this one

    Please Login or Register  to view this content.

  7. #7
    Registered User
    Join Date
    01-07-2013
    Location
    TOronto, Canada
    MS-Off Ver
    Excel 2007
    Posts
    8

    Re: Search for content in cell from another worksheet, copy row, and pastevalue

    thanks so much!. This almost works.

    Only two things.

    1. it seems that this pulls data from the entire workbook. is it possible for it to pull only from Sheets("Data")?
    2. How do i make it so that i copys column A as well? It currently copies from column B.

    thanks!

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

    Re: Search for content in cell from another worksheet, copy row, and pastevalue

    Please Login or Register  to view this content.

  9. #9
    Registered User
    Join Date
    01-07-2013
    Location
    TOronto, Canada
    MS-Off Ver
    Excel 2007
    Posts
    8

    Re: Search for content in cell from another worksheet, copy row, and pastevalue

    Perfect!!! thanks !!!!!

    However I just realized something else. It's my own fault. What we have done here is to find matching contents in entire cells. Is there a way to match value in part of the cells?
    For example if a cell says "c12, c14, c15" and I search the C12?

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

    Re: Search for content in cell from another worksheet, copy row, and pastevalue

    I do not know, but you can search for part of a cell

    Change this line of code

    Please Login or Register  to view this content.
    In to

    Please Login or Register  to view this content.
    But this does the reverse you are looking for.

  11. #11
    Registered User
    Join Date
    01-07-2013
    Location
    TOronto, Canada
    MS-Off Ver
    Excel 2007
    Posts
    8

    Re: Search for content in cell from another worksheet, copy row, and pastevalue

    THANKS SO MUCH!!!! works like a charm!
    Last edited by UD2; 01-11-2013 at 05:19 PM.

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

    Re: Search for content in cell from another worksheet, copy row, and pastevalue

    You are welcome!
    Please close this thread as solved. Go in to the top right hand of this page, select, "Solved" from the "Thread Tools", drop down menu

+ 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