+ Reply to Thread
Results 1 to 7 of 7

Copying and Inserting Range of Rows After Last One Inserted

  1. #1
    Registered User
    Join Date
    07-03-2013
    Location
    Missoula
    MS-Off Ver
    Excel 2010
    Posts
    3

    Post Copying and Inserting Range of Rows After Last One Inserted

    Hello. I'm in desperate need of some VBA help. I'm trying to copy a range of rows from above, clear the contents and insert the copied rows below. It works the first time, but then always inserts the new rows above all of the old ones. How do I get the rows being copied to be inserted at the end of the of the last range of rows copied? I also need to do this for columns. Below is code that I recorded. Please help.

    Please Login or Register  to view this content.
    Last edited by swoosiebur; 07-05-2013 at 10:24 PM. Reason: As per Forum Rule #3, please use code tags…Thanks.

  2. #2
    Valued Forum Contributor
    Join Date
    06-17-2009
    Location
    Chennai,India
    MS-Off Ver
    Excel 2003,excel 2007
    Posts
    678

    Re: Copying and Inserting Range of Rows After Last One Inserted

    suppose sample data is like this entered in sheet 2 repeat 2
    hdng1 hdng2 hdng3 hdng4
    1 x x x
    2 x x x
    3 x x x
    4 x x x
    5 x x x
    6 x x x
    7 x x x

    now run the macro test only

    Please Login or Register  to view this content.
    Please Login or Register  to view this content.

    MODIFY TO SUIT YOU
    I am not an expert. better solutions may be available
    $$$$venkat1926$$$$@gmail.com

  3. #3
    Valued Forum Contributor rollis13's Avatar
    Join Date
    01-26-2012
    Location
    Cordenons
    MS-Off Ver
    Excel 2016 32bit - Win 11
    Posts
    935

    Re: Copying and Inserting Range of Rows After Last One Inserted

    Have a try with this:
    Please Login or Register  to view this content.
    Last edited by rollis13; 07-06-2013 at 10:25 AM.

  4. #4
    Registered User
    Join Date
    07-03-2013
    Location
    Missoula
    MS-Off Ver
    Excel 2010
    Posts
    3

    Re: Copying and Inserting Range of Rows After Last One Inserted

    Thanks so much for your help. It's still not doing what I need it to do. Perhaps I'll try to clarify. I need rows 6:25 to be copied and inserted below, below other rows of data (which would be shifted down). The newly copied rows would then need to be cleared and I would need to run this for as many times as I need to insert the new cells. Does this make sense. I new to this macro thing so I do really appreciate all of your help.

  5. #5
    Valued Forum Contributor rollis13's Avatar
    Join Date
    01-26-2012
    Location
    Cordenons
    MS-Off Ver
    Excel 2016 32bit - Win 11
    Posts
    935

    Re: Copying and Inserting Range of Rows After Last One Inserted

    Do you mean that every time you run the macro rows 6:25 need to be copied and then inserted starting at row 26 pushing down whatever found at 26 and below ?
    If so, try:
    Please Login or Register  to view this content.
    Last edited by rollis13; 07-07-2013 at 03:47 AM.

  6. #6
    Registered User
    Join Date
    07-03-2013
    Location
    Missoula
    MS-Off Ver
    Excel 2010
    Posts
    3

    Re: Copying and Inserting Range of Rows After Last One Inserted

    That's exactly what I'm looking for. Thanks so much! I'll give this a try when I get to work first thing tomorrow. I don't know about you, but learning macros is completely addicting. One more question. Will this macro work so that every time it's run, Rows "6:25" will be copied and pasted below the last range pasted.?

    Thanks again for your help.

  7. #7
    Valued Forum Contributor rollis13's Avatar
    Join Date
    01-26-2012
    Location
    Cordenons
    MS-Off Ver
    Excel 2016 32bit - Win 11
    Posts
    935

    Re: Copying and Inserting Range of Rows After Last One Inserted

    Quote Originally Posted by swoosiebur View Post
    [...]Will this macro work so that every time it's run, Rows "6:25" will be copied and pasted below the last range pasted ?[...]
    No, that was the code in post#3 that pasted below the last range, code in post#5 will always paste in row 26 pushing down whatever found.

+ 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