+ Reply to Thread
Results 1 to 6 of 6

Finding multiple values and copying the whole row in a new sheet

  1. #1
    Registered User
    Join Date
    02-28-2015
    Location
    Zagreb
    MS-Off Ver
    MS Office 2007
    Posts
    3

    Finding multiple values and copying the whole row in a new sheet

    Hello, I have a excel table with user info. There are 1000 rows and a few columns (name, address, email...). What I would like to do is make a macro that would do the following: Search the whole table with multiple values (user street name) I input and when there is a match copy the whole row into another sheet.

    So far I've been using this:

    Please Login or Register  to view this content.
    Sheet 3 is where i input the names of the streets I need inside column A starting from A2, sheet 2 is where the rows should be copied and column D inside sheet 1 is where all the street names are. Currently the code just copies the first row of sheet 1 no matter what is written there and ignores everything else. I'm using MS Office 2007. Every help would be appreciated. Thanks!

  2. #2
    Forum Expert Vikas_Gautam's Avatar
    Join Date
    06-04-2013
    Location
    Ludhiana,Punjab, India
    MS-Off Ver
    Excel 2013
    Posts
    1,850

    Re: Finding multiple values and copying the whole row in a new sheet

    I guess, you need advanced filter technique.

    So
    Attach a sample workbook. Make sure there is just enough data to demonstrate your need. Include a BEFORE sheet and an AFTER sheet in the workbook if needed to show the process you're trying to complete or automate. Make sure your desired results are shown, mock them up manually if necessary.

    Remember to desensitize the data.

    Click on GO ADVANCED and use the paperclip icon to open the upload window.

    View Pic
    Regards,
    Vikas Gautam
    Excel-buzz.blogspot.com

    Excel is not a matter of Experience, its a matter of Application.

    Say Thanks, Click * Add Reputation

  3. #3
    Registered User
    Join Date
    02-28-2015
    Location
    Zagreb
    MS-Off Ver
    MS Office 2007
    Posts
    3

    Re: Finding multiple values and copying the whole row in a new sheet

    Here are the examples. In the "BEFORE example" there is a simple list of imaginary user info on sheet1. Sheet3 is where I type in the street names I'm interested in inside column A. The macro should find all users who have the same street name as the ones I typed in inside sheet3 and copy their whole info to sheet2. You can see the result in the AFTER example.

    What I'm basically trying to do is categorize users by city districts using street names that are a part of those city districts.
    Attached Files Attached Files
    Last edited by ZuluKing22; 02-28-2015 at 10:16 AM.

  4. #4
    Forum Guru
    Join Date
    04-13-2005
    Location
    North America
    MS-Off Ver
    2002/XP and 2007
    Posts
    15,849

    Re: Finding multiple values and copying the whole row in a new sheet

    I will agree with Vikas_Gautam -- this sounds like a job for advanced filter (I'm sure one can write a macro for the job, but why reinvent the wheel?)

    https://support.office.com/en-US/art...rs=en-US&ad=US
    If you prefer a video tutorial https://support.office.com/en-US/art...7-6AD3774DC420
    Quote Originally Posted by shg
    Mathematics is the native language of the natural world. Just trying to become literate.

  5. #5
    Forum Expert Vikas_Gautam's Avatar
    Join Date
    06-04-2013
    Location
    Ludhiana,Punjab, India
    MS-Off Ver
    Excel 2013
    Posts
    1,850

    Re: Finding multiple values and copying the whole row in a new sheet

    Here is the required solution.

    HTML Code: 
    You can add more conditions. Just make sure column heading in the Criteria Range(cRng) must match with that of Master Table(mRng).
    You can also use Wild Cards in Criterias.

    Here is the link to learn Advanced filter basics.
    http://www.contextures.com/xladvfilter01.html

    Check the attached file:-
    Attached Files Attached Files
    Last edited by Vikas_Gautam; 02-28-2015 at 03:14 PM.

  6. #6
    Registered User
    Join Date
    02-28-2015
    Location
    Zagreb
    MS-Off Ver
    MS Office 2007
    Posts
    3

    Re: Finding multiple values and copying the whole row in a new sheet

    Vikas_Gautam and MrShorty, excelforum's MVPs! Thank you!

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

Similar Threads

  1. Copying multiple cell values into another sheet
    By ucldon in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 07-26-2014, 12:57 PM
  2. Finding values greater than zero and copying to another sheet
    By pasqualebaldi in forum Excel Programming / VBA / Macros
    Replies: 6
    Last Post: 05-14-2014, 06:36 PM
  3. [SOLVED] Macro for Finding Sheet Names, then Copying/Pasting Values
    By Joel.Nemec in forum Excel Programming / VBA / Macros
    Replies: 6
    Last Post: 07-09-2012, 01:28 PM
  4. copying & pasting multiple values from one sheet to another
    By phdog in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 05-04-2009, 03:05 AM
  5. Finding Values for Multiple Ranges in one Sheet
    By adnan.rehman in forum Excel Formulas & Functions
    Replies: 1
    Last Post: 08-03-2007, 12:37 AM

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