+ Reply to Thread
Results 1 to 5 of 5

Thread: Macro copy data to next empty line (help please)

  1. #1
    Registered User
    Join Date
    01-24-2012
    Location
    Netherlands
    MS-Off Ver
    Excel 2007
    Posts
    5

    Macro copy data to next empty line (help please)

    Please find the attached file.
    The data from the first sheet is set in one line in the second sheet.
    With a macro I copy this line to the third sheet which should act as a small database of test values.
    Please look at the macro, I want the macro to take the next emply row to copy to each time instead that one line is set in the macro.

    Can anyone tell me how to do this?

    Thanks

    (ps for privacy reasons a x is in most cells)
    Attached Files Attached Files

  2. #2
    Forum Moderator arlu1201's Avatar
    Join Date
    09-09-2011
    Location
    Bangalore, India
    MS-Off Ver
    Excel 2003 & 2007
    Posts
    4,396

    Re: Macro copy data to next empty line (help please)

    If its a normal copy paste - use this code
     Worksheets("transfer").Range("A1:T1").Copy Worksheets("d-base").Range("A" & Rows.Count).End(xlUp).Offset(1, 0)
    (i changed your entire code to the above code line).
    If its a paste special use this code -
    Worksheets("transfer").Range("A1:T1").Copy
        Worksheets("d-base").Range("A" & Rows.Count).End(xlUp).Offset(1, 0).PasteSpecial Paste:=xlPasteValues, operation:=xlNone, skipblanks _
            :=False, Transpose:=False
    Last edited by arlu1201; 01-24-2012 at 05:56 AM.
    Cheers,
    Arlette

    If I 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]

  3. #3
    Registered User
    Join Date
    01-24-2012
    Location
    Netherlands
    MS-Off Ver
    Excel 2007
    Posts
    5

    Re: Macro copy data to next empty line (help please)

    Hi arly1201,

    I used the code, but I got debug messages.
    Can you adjust the file and post it?
    Or else send it to 01mercy@live.nl

    Thanks

  4. #4
    Forum Moderator arlu1201's Avatar
    Join Date
    09-09-2011
    Location
    Bangalore, India
    MS-Off Ver
    Excel 2003 & 2007
    Posts
    4,396

    Re: Macro copy data to next empty line (help please)

    I didnt face any issues. I just edited your existing code with the 2ndcode i gave above and it worked fine. Do not use the first one as it gives errors (i guess you have formulae in your transfer sheet so its creating errors).
    Cheers,
    Arlette

    If I 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]

  5. #5
    Registered User
    Join Date
    01-24-2012
    Location
    Netherlands
    MS-Off Ver
    Excel 2007
    Posts
    5

    Re: Macro copy data to next empty line (help please)

    You're right arlu I used it in the original file and there were some other macro's in the background or how you would call it, the file I used for this forum works fine.
    Thanks a lot!

+ 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.2.0