+ Reply to Thread
Results 1 to 14 of 14

Copy entire row based on a criteria - using macro

  1. #1
    Registered User
    Join Date
    02-04-2012
    Location
    Philippines
    MS-Off Ver
    Excel 2007
    Posts
    40

    Copy entire row based on a criteria - using macro

    step: 1. search a criteria in a "sheet1" column "B" [input bow or textbox in a form]
    2. copy entire row matches the step 1 until
    3. meet a criteria in colum "A"
    4. paste in another sheet

    is it possible to have different criteria in step 1.


    Thanks.

  2. #2
    Forum Expert DGagnon's Avatar
    Join Date
    02-23-2012
    Location
    Ontario, Canada
    MS-Off Ver
    Excel 2003, 2007
    Posts
    1,645

    Re: Copy entire row based on a criteria - using macro

    could you please provide a sample data set, and desired output?
    If you liked my solution, please click on the Star -- to add to my reputation

    If your issue as been resolved, please clearly state so and mark the thread as [SOLVED] using the thread tools just above the first post.

  3. #3
    Registered User
    Join Date
    02-04-2012
    Location
    Philippines
    MS-Off Ver
    Excel 2007
    Posts
    40

    Re: Copy entire row based on a criteria - using macro

    My Steps:

    1. Enter "Text"
    2. Find in Column B [Text.Criteria], if found copy.entire row until column "A" = Text"B"
    3. paste in sheet2 nxt epmty cell column "A"
    4. Loop [finding Text.Criteria] if not found - End


    Hi here's my datasheet.

    Thanks.
    Attached Files Attached Files
    Last edited by scambug; 03-15-2012 at 02:59 AM.

  4. #4
    Forum Expert DGagnon's Avatar
    Join Date
    02-23-2012
    Location
    Ontario, Canada
    MS-Off Ver
    Excel 2003, 2007
    Posts
    1,645

    Re: Copy entire row based on a criteria - using macro

    where do you want the user to input the 'Text' in step 1?

  5. #5
    Registered User
    Join Date
    02-04-2012
    Location
    Philippines
    MS-Off Ver
    Excel 2007
    Posts
    40

    Re: Copy entire row based on a criteria - using macro

    in a userform with a textbox

  6. #6
    Forum Expert DGagnon's Avatar
    Join Date
    02-23-2012
    Location
    Ontario, Canada
    MS-Off Ver
    Excel 2003, 2007
    Posts
    1,645

    Re: Copy entire row based on a criteria - using macro

    Take a look at the attached and let me know what you think
    Attached Files Attached Files

  7. #7
    Registered User
    Join Date
    03-05-2012
    Location
    usa
    MS-Off Ver
    Excel 2010
    Posts
    19

    Re: Copy entire row based on a criteria - using macro

    Maybe because it's Friday and my brain is not working, but I need the same kind of Macro in an Excel sheet. I have down loaded the sample done.xls but ican't seem to get it working! What should my criteria be in the Search box?

  8. #8
    Forum Expert DGagnon's Avatar
    Join Date
    02-23-2012
    Location
    Ontario, Canada
    MS-Off Ver
    Excel 2003, 2007
    Posts
    1,645

    Re: Copy entire row based on a criteria - using macro

    the search box should contain entries from column B

  9. #9
    Registered User
    Join Date
    03-05-2012
    Location
    usa
    MS-Off Ver
    Excel 2010
    Posts
    19

    Re: Copy entire row based on a criteria - using macro

    Column B being the 8 digit numbers? I still get no results in a message box every time.

  10. #10
    Forum Expert DGagnon's Avatar
    Join Date
    02-23-2012
    Location
    Ontario, Canada
    MS-Off Ver
    Excel 2003, 2007
    Posts
    1,645

    Re: Copy entire row based on a criteria - using macro

    sorry friday brain... try this
    Attached Files Attached Files

  11. #11
    Registered User
    Join Date
    03-05-2012
    Location
    usa
    MS-Off Ver
    Excel 2010
    Posts
    19

    Re: Copy entire row based on a criteria - using macro

    Very Cool, Thanks

  12. #12
    Registered User
    Join Date
    02-04-2012
    Location
    Philippines
    MS-Off Ver
    Excel 2007
    Posts
    40

    Re: Copy entire row based on a criteria - using macro

    thanks. but, what if 1 textbox and a button only. searchable data is in column B,
    after search it copies all rows until it end in a specific criteria in column A.
    the specific criteria in column A is fixed.

  13. #13
    Registered User
    Join Date
    05-20-2013
    Location
    Malaysia
    MS-Off Ver
    Excel 2003
    Posts
    1

    Re: Copy entire row based on a criteria - using macro

    Sorry for asking this only now.
    I downloaded the sampledone2. The search option can only search for 1 row of data but how about other data matches the criteria?

  14. #14
    Forum Contributor arlu1201's Avatar
    Join Date
    09-09-2011
    Location
    Bangalore, India
    MS-Off Ver
    Excel 2003 & 2007
    Posts
    19,167

    Re: Copy entire row based on a criteria - using macro

    jonson86,

    Unfortunately you need to post your question in a new thread, it's against the forum rules to post a question in the thread of another user. If you create your own thread, any advice will be tailored to your situation so you should include a description of what you've done and are trying to do. Also, if you feel that this thread is particularly relevant to what you are trying to do, you can surely include a link to it in your new thread.
    If I have helped, Don't forget to add to my reputation (click on the star below the post)
    Don't forget to mark threads as "Solved" (Thread Tools->Mark thread as Solved)
    Use code tags when posting your VBA code: [code] Your code here [/code]

+ 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