+ Reply to Thread
Results 1 to 9 of 9

Search for a value in a column and copy row to new sheet for all matching values

  1. #1
    Registered User
    Join Date
    02-13-2015
    Location
    Singapore
    MS-Off Ver
    2007
    Posts
    5

    Search for a value in a column and copy row to new sheet for all matching values

    Greetings All,

    I have been working on a macro that allows me to search for a value in a column and copy the row with matching values to a new sheet.
    The following web link has greatly assisted me with running a macro - http://www.techonthenet.com/excel/ma...for_string.php

    Unfortunately, the raw data i have present doesn't allow the macro to fully function and i need some guidance with resolving this issue.

    The current macro only identifies and copies cells with a single value. However my raw data has several options codes within a cell.

    Dd.jpg
    Is it possible to modify the following formula to identify a specific value within a range of values? If Range("D" & CStr(LSearchRow)).Value = Range("C1") Then

    If else should i split the options to separate cells? If that's the case how do i expend the current range from "D" to "D","E","F"?

    Truly appreciate your assistance!

    Thank you in advance,
    Gopi
    Attached Files Attached Files

  2. #2
    Forum Moderator davesexcel's Avatar
    Join Date
    02-19-2006
    Location
    Regina
    MS-Off Ver
    MS 365
    Posts
    13,524

    Re: Search for a value in a column and copy row to new sheet for all matching values

    You lost me at the end of your question, and the sample did not explain what you are talking about
    expend the current range from "D" to "D","E","F"?
    Anyway, here is a code just for you,

    It uses A Filter, and does not select any cells,

    Please Login or Register  to view this content.
    You should easily see in the code how to expand the range

  3. #3
    Registered User
    Join Date
    02-13-2015
    Location
    Singapore
    MS-Off Ver
    2007
    Posts
    5

    Re: Search for a value in a column and copy row to new sheet for all matching values

    Hello Dave,

    Many thanks for assisting with my query.

    I had tried using your code. Unfortunately, it still extracts cells with a single value.

    For instance when i try extracting all rows that contain cells with value "RAF" , only the 1st 6 rows are extracted to sheet 2. What i would need is for RAF in row 10,11 and 12 to be copied to sheet 2 as well.

    How would this be possible?

    Regards,
    Gopi
    Attached Files Attached Files

  4. #4
    Forum Moderator davesexcel's Avatar
    Join Date
    02-19-2006
    Location
    Regina
    MS-Off Ver
    MS 365
    Posts
    13,524

    Re: Search for a value in a column and copy row to new sheet for all matching values

    Please Login or Register  to view this content.

  5. #5
    Registered User
    Join Date
    02-13-2015
    Location
    Singapore
    MS-Off Ver
    2007
    Posts
    5

    Re: Search for a value in a column and copy row to new sheet for all matching values

    Perfect, thanks a tonne Dave!

  6. #6
    Registered User
    Join Date
    02-13-2015
    Location
    Singapore
    MS-Off Ver
    2007
    Posts
    5

    Re: Search for a value in a column and copy row to new sheet for all matching values

    Hi Dave,

    Please refer to my attachment, the last step i would like to take is instead of extracting rows that contains the search value, i would like to create a macro to extract all rows that does not contain the search value "B1".

    Would it be possible to use the same fundamentals of the macro you had provided?

    I truly appreciate your assistance

    Cheers,
    Gopi
    Attached Files Attached Files

  7. #7
    Valued Forum Contributor
    Join Date
    03-22-2013
    Location
    Australia,NSW, Wirrimbi
    MS-Off Ver
    Excel 2013
    Posts
    1,057

    Re: Search for a value in a column and copy row to new sheet for all matching values

    Hi.. Maybe change:

    Please Login or Register  to view this content.
    to:

    Please Login or Register  to view this content.

  8. #8
    Registered User
    Join Date
    02-13-2015
    Location
    Singapore
    MS-Off Ver
    2007
    Posts
    5

    Re: Search for a value in a column and copy row to new sheet for all matching values

    Hi Apo,

    Many thanks, it worked perfectly

  9. #9
    Registered User
    Join Date
    09-03-2016
    Location
    India
    MS-Off Ver
    2007
    Posts
    4

    Re: Search for a value in a column and copy row to new sheet for all matching values

    Dear All,

    Jus Amazing..

    Many Thanks, it definitely can be solve my problem also

    Regards,
    Chirag Raval

+ 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. Code to search for matching values in two columns, take text from that row and copy
    By Excelsemi in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 05-23-2014, 12:12 PM
  2. Replies: 3
    Last Post: 03-31-2014, 01:00 PM
  3. Need a Macro to search for text in sheet and copy the matching row to new sheet
    By robin_108 in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 10-08-2012, 12:59 PM
  4. [SOLVED] Search and count matching values in each column
    By sans in forum Excel Programming / VBA / Macros
    Replies: 27
    Last Post: 05-25-2012, 02:50 AM
  5. [SOLVED] Search for a value in a column and copy row to new sheet for all matching values
    By mrcois in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 05-20-2012, 12:09 PM

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