+ Reply to Thread
Results 1 to 12 of 12

Search, copy and paste entire row into new workbook

  1. #1
    Registered User
    Join Date
    02-03-2010
    Location
    Cleveland, Ohio
    MS-Off Ver
    Excel 2007
    Posts
    40

    Search, copy and paste entire row into new workbook

    I need a code that will search column A over multiple sheets for a user specified value through an input box. I then need this code to copy and paste the entire row to a new workbook titled "Batch Report" Anyone have any ideas? I have a code that will copy and paste only a few rows but no where near all of them, and I cant figure out why. Thanks.

  2. #2
    Valued Forum Contributor
    Join Date
    05-14-2009
    Location
    gold coast
    MS-Off Ver
    Excel 2007
    Posts
    843

    Re: Search, copy and paste entire row into new workbook

    hello,

    This should work using the autofilter
    Please Login or Register  to view this content.
    cheers


  3. #3
    Registered User
    Join Date
    02-03-2010
    Location
    Cleveland, Ohio
    MS-Off Ver
    Excel 2007
    Posts
    40

    Re: Search, copy and paste entire row into new workbook

    This seems to be close to what I am looking for, except I get a runtime errror 1004 after. Also I want to pre-format the sheet that the batch numbers will be sent to so that it matches the sheets that they will be taken from. So how would I make these selections be placed into the next available row rather than row 1.

    Thanks

  4. #4
    Valued Forum Contributor
    Join Date
    05-14-2009
    Location
    gold coast
    MS-Off Ver
    Excel 2007
    Posts
    843

    Re: Search, copy and paste entire row into new workbook

    Ok Could you post a workbook and i will take a look at in in the morning.

    cheers

  5. #5
    Registered User
    Join Date
    02-03-2010
    Location
    Cleveland, Ohio
    MS-Off Ver
    Excel 2007
    Posts
    40

    Re: Search, copy and paste entire row into new workbook

    I have attached my workbook and have the code under button 28. My goal is to create a new workbook that is formatted like the sheets on the original workbook so when I go to generate a batch report, the rows start to copy in the next available row. Also when I hit cancel on the inputbox I get a different runtime error, and Im not sure how to fix that. Any help would be greatly appreciated.

    Thanks
    Attached Files Attached Files

  6. #6
    Valued Forum Contributor
    Join Date
    05-14-2009
    Location
    gold coast
    MS-Off Ver
    Excel 2007
    Posts
    843

    Re: Search, copy and paste entire row into new workbook

    hello,

    ive taken the vba hammer out and tryed to bash the square peg in the round hole,

    Please Login or Register  to view this content.
    not verry pritty though i think it does what you ae chasing.

    cheers

  7. #7
    Registered User
    Join Date
    02-03-2010
    Location
    Cleveland, Ohio
    MS-Off Ver
    Excel 2007
    Posts
    40

    Re: Search, copy and paste entire row into new workbook

    Hello,

    You have done an amazing job that is almost exactly what I was looking for. I am however, getting an unknown number in column I, which I believe should be the "date ordered," but i am getting a number in the thousands. Also, I love how you set the code up to transfer the colums headers. Would it be possible to add the column headers to colums I, J, and K as well. These can be seen on all sheets except the first one in my workbook. Also, is it possible to merge cells 3 and 4 like I have it in my main workbook. If you could help me out with these, that would be great.

    Thanks

  8. #8
    Valued Forum Contributor
    Join Date
    05-14-2009
    Location
    gold coast
    MS-Off Ver
    Excel 2007
    Posts
    843

    Re: Search, copy and paste entire row into new workbook

    just some minor tweeks

    is it possible to merge cells 3 and 4 like I have it in my main workbook. If you could help me out with these, that would be great.
    Merged cell are a real pain to have to deal with, In future you are better off selecting groupes and formatting the cell as CENTER TEXT ACROSS SELECTION.

    let me know how this goes
    Please Login or Register  to view this content.
    cheers
    Last edited by D_Rennie; 02-24-2010 at 08:24 PM.

  9. #9
    Valued Forum Contributor
    Join Date
    05-14-2009
    Location
    gold coast
    MS-Off Ver
    Excel 2007
    Posts
    843

    Re: Search, copy and paste entire row into new workbook

    ..........................

  10. #10
    Registered User
    Join Date
    02-03-2010
    Location
    Cleveland, Ohio
    MS-Off Ver
    Excel 2007
    Posts
    40

    Re: Search, copy and paste entire row into new workbook

    That is the exact code I have been looking for thank you very much. I just wanted to make sure that this code is set up to search the entire column A no matter how many pages I may have, because eventually I will have a few thousand rows. Also will it search every sheet, because I plan to have a couple hundred sheets as well? But thanks again you have configured the code exactly how I wanted. Thanks


    Andrew

  11. #11
    Valued Forum Contributor
    Join Date
    05-14-2009
    Location
    gold coast
    MS-Off Ver
    Excel 2007
    Posts
    843

    Re: Search, copy and paste entire row into new workbook

    Yes the code will work on every sheet in the workbook.
    Its not realy searching every row the code places a autofilter on the sheet and copies those rows to the destination book. then removes the autofilter and moves onto the next sheet.

    Glad i could help

    cheers

  12. #12
    Registered User
    Join Date
    05-06-2010
    Location
    India
    MS-Off Ver
    Excel 2003
    Posts
    2

    Re: Search, copy and paste entire row into new workbook

    Quote Originally Posted by D_Rennie View Post
    Yes the code will work on every sheet in the workbook.
    Its not realy searching every row the code places a autofilter on the sheet and copies those rows to the destination book. then removes the autofilter and moves onto the next sheet.

    Glad i could help

    cheers
    Hi there,
    I have a excel workbook containing 20,000 rows of data. I will have to develop a macro to copy a certain range of data from that excel workbook & paste the same in another excel workbook, rename the workbook & save. Suppose one column contains certain rows with values as 1, next set of rows as column value=2, another set of rows as values =3. I will have to take all the rows corresponding to value 1 and paste in the second excel workbook, rename, save & close. This process repeats for column values=2 & 3 as well.Please help in writing the Macro Code. It seems preety similar with a slight different touch. your answer will be well appreciated.

    The source Excel resides in the location:E:\Ani\SIMS
    The destination excel resides in the location :C:\AM\SIT

+ 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