+ Reply to Thread
Results 1 to 9 of 9

Excel 2007 : Copying row(s) of data from one sheet to rows in another worksheet

  1. #1
    Registered User
    Join Date
    08-04-2011
    Location
    Toronto
    MS-Off Ver
    Excel 2007
    Posts
    8

    Copying row(s) of data from one sheet to rows in another worksheet

    Hi,

    I'm hoping someone can help. I have created a workbook with two sheets. A sheet named "Invoice" and another named "Sales Summary Sheet" (SSS).

    After clicking on a button (on the Invoice sheet), data in specific cells get copied to specific cells in SSS.

    I want to copy row(s) depending on how many rows are entered into the Invoice template, to the SSS sheet. Currently rows A19:H19, A20:H20, A21:H21...to A32:H32 are rows that can have potential data in it that need to be copied to rows in the SSS sheet.

    For every row in the Invoice sheet, I need to copy the data to a new row in the SSS sheet (and not overwrite existing rows of data in the SSS sheet). So for example row A19:A32 need to be copied to A2:O2, and if data in B19:B32 exists , then it also needs to be copied to A3:O3.

    Once SSS is saved, the next time I open Invoice and re-enter data into A19:A32, it will add the data into SSS in cells A4:O4.

    Right now I have this current code:
    Please Login or Register  to view this content.
    When I run the above code, it only copies row A19:H19 in the Invoice sheet to row A2:O2 in SSS, and DOES NOT copy the second (third, fourth...) row of data to SSS.

    Any help would be GREATLY APPRECIATED!

    Thanks.
    Attached Files Attached Files
    Last edited by DazedConfuzed; 08-08-2011 at 01:28 PM.

  2. #2
    Forum Expert JBeaucaire's Avatar
    Join Date
    03-21-2004
    Location
    Bakersfield, CA
    MS-Off Ver
    2010, 2016, Office 365
    Posts
    33,492

    Re: Copying row(s) of data from one sheet to rows in another worksheet

    Hi Dazed... Welcome to the forum.

    Be sure to read through the Forum Rules so you can use and follow them effectively. For instance, you'll need to EDIT that post above and put code tags around that code you used. (Like shown in my signature)

    Also, there is a Programming Forum for programming questions.

    I'll take a look at your query for you momentarily, in the meantime fix that post above so it doesn't get tagged by the moderators. Thanks.
    _________________
    Microsoft MVP 2010 - Excel
    Visit: Jerry Beaucaire's Excel Files & Macros

    If you've been given good help, use the icon below to give reputation feedback, it is appreciated.
    Always put your code between code tags. [CODE] your code here [/CODE]

    ?None of us is as good as all of us? - Ray Kroc
    ?Actually, I *am* a rocket scientist.? - JB (little ones count!)

  3. #3
    Forum Expert JBeaucaire's Avatar
    Join Date
    03-21-2004
    Location
    Bakersfield, CA
    MS-Off Ver
    2010, 2016, Office 365
    Posts
    33,492

    Re: Copying row(s) of data from one sheet to rows in another worksheet

    Your sample code also does not really shed light to enhance the verbal part of your question.

    This forum allows attachments (Use the GO ADVANCED option, then the paperclip icon). Please upload a sample workbook showing an invoice with mutliple rows to transfer and then manually mockup the exact results required so we can see the BEFORE/AFTER, so to speak.

  4. #4
    Forum Expert JBeaucaire's Avatar
    Join Date
    03-21-2004
    Location
    Bakersfield, CA
    MS-Off Ver
    2010, 2016, Office 365
    Posts
    33,492

    Re: Copying row(s) of data from one sheet to rows in another worksheet

    Based on the verbal question only, this is all that's really needed, which I'm sure is not correct since you showed so much other activity in your code.
    Please Login or Register  to view this content.

  5. #5
    Forum Expert JBeaucaire's Avatar
    Join Date
    03-21-2004
    Location
    Bakersfield, CA
    MS-Off Ver
    2010, 2016, Office 365
    Posts
    33,492

    Re: Copying row(s) of data from one sheet to rows in another worksheet


  6. #6
    Registered User
    Join Date
    08-04-2011
    Location
    Toronto
    MS-Off Ver
    Excel 2007
    Posts
    8

    Re: Copying row(s) of data from one sheet to rows in another worksheet

    Thank you for your sincere help. I did a test with the code you provided. It did copy the second row in the invoice table, however it also copied the remaining blank rows in the table along with the table cell widths and border.

    The code I have does exactly what I need it to, but for some reason it doesn't recognize that there's are values in the second row (in the Invoice) that have to also be transferred to the SS sheet.

    I tried with this code as well
    Please Login or Register  to view this content.


    This coding works well BUT it's glitch is that it pastes the first row in the Invoice table 13 times. It doesn't paste the values in the second row of the invoice table at all. (please see attachment).

    Sigh...
    Attached Files Attached Files

  7. #7
    Forum Expert JBeaucaire's Avatar
    Join Date
    03-21-2004
    Location
    Bakersfield, CA
    MS-Off Ver
    2010, 2016, Office 365
    Posts
    33,492

    Re: Copying row(s) of data from one sheet to rows in another worksheet

    If you'd like to post the actual workbook, I can test this out and find what is causing the problem quite readily.

  8. #8
    Forum Expert JBeaucaire's Avatar
    Join Date
    03-21-2004
    Location
    Bakersfield, CA
    MS-Off Ver
    2010, 2016, Office 365
    Posts
    33,492

    Re: Copying row(s) of data from one sheet to rows in another worksheet

    Based on the example workbook you were supposed to post here but posted in your duplicate thread, then:
    Please Login or Register  to view this content.

    Also, in your Module1, these macros simplify down to:
    Please Login or Register  to view this content.
    Last edited by JBeaucaire; 08-07-2011 at 12:07 AM.

  9. #9
    Registered User
    Join Date
    08-04-2011
    Location
    Toronto
    MS-Off Ver
    Excel 2007
    Posts
    8

    [SOLVED] Copying row(s) of data from one sheet to rows in another worksheet



    it works! You rock. Thank you!
    Last edited by DazedConfuzed; 08-08-2011 at 01:27 PM.

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

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