+ Reply to Thread
Results 1 to 9 of 9

Copy range into specific row and shift other rows down

  1. #1
    Registered User
    Join Date
    05-13-2014
    MS-Off Ver
    Excel:Mac 2011 14.4.1
    Posts
    25

    Copy range into specific row and shift other rows down

    Hard to describe, and I guess that's why it's such a seemingly simple issue that I can't find a solution for, but I'm trying to create a macro to copy data from a range of cells and insert it a few rows down, displacing any data in that cell downward, and adding specific text (year). I've pretty much solved everything of the macro except inserting the data into the right cells; I can only get it to be copied directly below the range I want to copy it from. Enclosed is a sample workbook based on what I'm trying to do, basically I want the "archive" button to move everything in the row for TOTALS down to where it says Last Year, and shifting that data downwards. So if performed correctly with the adding of text as mentioned above, it should add TOTALS where Last Year is (moving Last Year down a row), then the user is prompted to type in the year which overwrites the TOTALS cell. This way the rows will be displayed as previous years going further into the past as the macro is used year to year.
    Here's the macro I've put together so far:
    Please Login or Register  to view this content.
    I'd appreciate any help/advice anyone can provide on this issue
    Below is the sample workbook.
    Attached Files Attached Files

  2. #2
    Forum Contributor
    Join Date
    01-30-2014
    Location
    England
    MS-Off Ver
    MS Office 2010, 2007, 2003
    Posts
    149

    Re: Copy range into specific row and shift other rows down

    Hi Nik

    Try this one, but I'd replace the rectange with a button
    Please Login or Register  to view this content.

  3. #3
    Registered User
    Join Date
    05-13-2014
    MS-Off Ver
    Excel:Mac 2011 14.4.1
    Posts
    25

    Re: Copy range into specific row and shift other rows down

    Sorry maybe I didn't explain thoroughly enough before, but I want to copy Totals and move it to where Last Year is, displacing Last Year downward and renaming Totals with the year. So the names in column A should go from "Totals, Rank, Margin, Gross Sales, Last Year" to "Totals, Rank, Margin, Gross Sales, 2014 (Totals copied, inserted, renamed with year), Last Year" and subsequently "Totals, Rank, Margin, Gross Sales, 2015 (new Totals copied, inserted, renamed with year) 2014 (original Totals copied, inserted, renamed with year), Last Year"

  4. #4
    Forum Contributor
    Join Date
    01-30-2014
    Location
    England
    MS-Off Ver
    MS Office 2010, 2007, 2003
    Posts
    149

    Re: Copy range into specific row and shift other rows down

    OK, I think I know what you mean.
    Would you be able to provide a file of the desired outcome, please? Just to be sure?

  5. #5
    Registered User
    Join Date
    05-13-2014
    MS-Off Ver
    Excel:Mac 2011 14.4.1
    Posts
    25

    Re: Copy range into specific row and shift other rows down

    Sure, here's essentially what it should look like, albeit with different values each instance.
    Attached Files Attached Files

  6. #6
    Forum Contributor
    Join Date
    01-30-2014
    Location
    England
    MS-Off Ver
    MS Office 2010, 2007, 2003
    Posts
    149

    Re: Copy range into specific row and shift other rows down

    Please Login or Register  to view this content.
    Takes A1:N1, puts the copied details into a new row below Gross Sales

    That what you're after?

  7. #7
    Registered User
    Join Date
    05-13-2014
    MS-Off Ver
    Excel:Mac 2011 14.4.1
    Posts
    25

    Re: Copy range into specific row and shift other rows down

    It's very very very close! Everything works, even when adjusting for the actual workbook, however I forgot to mention that it should be pasting the values, not formulas. So currently if I clear the totals section, it will clear the archive as well as it's not the raw numbers. I tried ActiveSheet.xlPasteValues but I get a run time error.

  8. #8
    Registered User
    Join Date
    05-13-2014
    MS-Off Ver
    Excel:Mac 2011 14.4.1
    Posts
    25

    Re: Copy range into specific row and shift other rows down

    Nevermind! Just solved it with Selection.PasteSpecial Paste:=xlPasteValues. Thanks alot guys!

  9. #9
    Forum Contributor
    Join Date
    01-30-2014
    Location
    England
    MS-Off Ver
    MS Office 2010, 2007, 2003
    Posts
    149

    Re: Copy range into specific row and shift other rows down

    No worries - glad to have helped
    If you could mark the thread as solved (click on edit on original post, go advanced) otherwise we'll be in the mods bad books

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

Similar Threads

  1. Replies: 1
    Last Post: 07-02-2014, 06:16 PM
  2. Replies: 0
    Last Post: 11-12-2013, 04:56 PM
  3. copy specific range of rows and columns according to a cell value
    By archangel9999 in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 02-26-2013, 03:41 PM
  4. Pick, copy and paste rows containing specific range of values
    By Kenneyd71 in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 11-20-2012, 09:44 AM
  5. copy header and rows toa specific excel range cell
    By karthikin in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 10-07-2012, 12:45 PM

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