+ Reply to Thread
Results 1 to 6 of 6

Macro Loop and Paste in next empty row

  1. #1
    Registered User
    Join Date
    05-14-2008
    Posts
    3

    Macro Loop and Paste in next empty row

    Hi All,
    I was hoping you could help, as Im new to macros etc...

    I recorded a macro, and I need it to loop AND to paste the next set of results in the next empty row...

    Im guessing this is pretty basic stuff, as Ive seen countless threads etc giving examples, but I just have not managed to get any to work :0s

    Could you help please?

    The macro recorded is...
    Please Login or Register  to view this content.
    When it loops, I need it to move down to the next A*:G* range until it hits an empty 'range'. The data copied from range C5:J37 then needs to be pasted in Sheet4, but in the next empty row.


    Any ideas?


    PS - sorry about not formatting the post correctly (earlier)
    Last edited by Rayhoop; 05-14-2008 at 11:18 AM.

  2. #2
    Forum Contributor VBA Noob's Avatar
    Join Date
    04-25-2006
    Location
    London, England
    MS-Off Ver
    xl03 & xl 07(Jan 09)
    Posts
    11,988
    Rayhoop,

    Welcome to the forum
    Please take 5 mins to read the forum rules below and then amend your title and wrap your code

    VBA Noob
    _________________________________________


    Credo Elvem ipsum etian vivere
    _________________________________________
    A message for cross posters

    Please remember to wrap code.

    Forum Rules

    Please add to your signature if you found this link helpful. Excel links !!!

  3. #3
    Registered User
    Join Date
    05-14-2008
    Posts
    3
    Right..

    Ive been having a play - close but no cigar.

    the code I have at the moment is

    Please Login or Register  to view this content.
    BUT... it does not select the next row and copy/paste the range into sheet2!c5 correctly :0(
    After the 1st attempt, odc appears to be incrementing (as the message box shows this), but it does not select/copy/paste the correct range - it appears as it is trying to copy the same range :0s

    Any ideas?

  4. #4
    Forum Contributor VBA Noob's Avatar
    Join Date
    04-25-2006
    Location
    London, England
    MS-Off Ver
    xl03 & xl 07(Jan 09)
    Posts
    11,988
    Rayhoop,

    Not sure I follow the logic of the code. Can you upload a sample workbook with a before and after or see if the below helps

    Usually you can find the last cell with this statement

    Please Login or Register  to view this content.
    This link explains in more detail

    http://www.rondebruin.nl/copy1.htm

    VBA Noob

  5. #5
    Registered User
    Join Date
    05-14-2008
    Posts
    3
    Cheers mate.

    I replaced the 'find last' with a crude method of selecting a cell 34 rows down using
    Please Login or Register  to view this content.
    34 because the number of rows selected from sheet2 were 33. However in the cut down demo spreadsheet I've only included a handful.

    My end loop statment doesnt work either :0( I have to 'escape' out of the macro.

    odc stands for 'original data cell', so in theory incrementing it by 1 would push the cell range down a row?

    Thanks again for your help.
    Attached Files Attached Files

  6. #6
    Forum Contributor VBA Noob's Avatar
    Join Date
    04-25-2006
    Location
    London, England
    MS-Off Ver
    xl03 & xl 07(Jan 09)
    Posts
    11,988
    Still not clear what your after. This copies Sheet 1 to Sheet 4. Note's may help

    Please Login or Register  to view this content.
    VBA Noob

+ 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