+ Reply to Thread
Results 1 to 4 of 4

Inserting and copying rows

  1. #1
    Registered User
    Join Date
    07-19-2013
    Location
    Uk
    MS-Off Ver
    Excel 2010
    Posts
    7

    Inserting and copying rows

    Hi,

    I'm trying to insert a new row underneath each existing row and copy the data in the existing row into the new one. I want to repeat this throughout the data set. to do it manually, I have to highlight the first row, release the mouse button, hold control, highlight the next row and repeat over and over. Very fiddly.
    The recorded macro is below and works fine for a small data set but anything bigger returns a "Runtime error 1004 Method of Global Range failed". I want to be able to do it every month for varying numbers of rows and be able to do it for up to at least 100 rows. It's driving me nuts, but my VBA knowledge is very basic. Any help much appreciated.


    Range( _
    "A3:K3,A4:K4,A5:K5,A6:K6,A7:K7,A8:K8,A9:K9,A10:K10,A11:K11,A12:K12,A13:K13,A14:K14,A15:K15,A16:K16,A17:K17,A18:K18,A19:K19" _
    ).Select
    Range("A41").Activate
    Selection.Insert Shift:=xlDown, CopyOrigin:=xlFormatFromLeftOrAbove
    Range("A3:K3").Select
    Selection.FillDown
    Range("A5:K5").Select
    Selection.FillDown
    Range("A7:K7").Select
    Selection.FillDown
    Range("A9:K9").Select
    Selection.FillDown
    Range("A11:K11").Select
    Selection.FillDown
    Range("A13:K13").Select
    Selection.FillDown
    Range("A15:K15").Select
    Selection.FillDown
    Range("A17:K17").Select
    Selection.FillDown
    Range("A19:K19").Select
    Selection.FillDown
    Range("A21:K21").Select
    Selection.FillDown
    Range("A23:K23").Select
    Selection.FillDown
    Range("A25:K25").Select
    Selection.FillDown
    Range("A27:K27").Select
    Selection.FillDown
    Range("A29:K29").Select
    Selection.FillDown
    Range("A31:K31").Select
    Selection.FillDown
    Range("A33:K33").Select
    Selection.FillDown
    Range("A35:K35").Select
    Selection.FillDown
    Range("A37:K37").Select
    Selection.FillDown
    Range("A39:K39").Select
    Selection.FillDown

  2. #2
    Forum Expert
    Join Date
    06-12-2012
    Location
    Ridgefield Park, New Jersey
    MS-Off Ver
    Excel 2003,2007,2010
    Posts
    10,241

    Re: Inserting and copying rows

    Maybe:

    Please Login or Register  to view this content.
    Try on a copy first (untested)

  3. #3
    Registered User
    Join Date
    07-19-2013
    Location
    Uk
    MS-Off Ver
    Excel 2010
    Posts
    7

    Re: Inserting and copying rows

    Thanks John,

    Works perfectly. Insanity kept at bay for one more day.

  4. #4
    Forum Expert
    Join Date
    06-12-2012
    Location
    Ridgefield Park, New Jersey
    MS-Off Ver
    Excel 2003,2007,2010
    Posts
    10,241

    Re: Inserting and copying rows

    You're welcome. Glad to help out and thanks for the feedback. Please comply with Forum Rule No. 9.

    9. Acknowledge the responses you receive, good or bad. If your problem is solved, please say so clearly, and mark your thread as Solved: Click Thread Tools above your first post, select "Mark your thread as Solved". Or click the Edit button on your first post in the thread, Click Go Advanced, select [SOLVED] from the Prefix dropdown, then click Save Changes. If more than two days have elapsed, the Dropdown option or Edit button will not appear -- ask a moderator to mark it.

+ 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. Copying and Inserting Range of Rows After Last One Inserted
    By swoosiebur in forum Excel Programming / VBA / Macros
    Replies: 6
    Last Post: 07-07-2013, 01:54 PM
  2. Macro for copying formulas + inserting rows
    By Marco-Kun in forum Excel Programming / VBA / Macros
    Replies: 8
    Last Post: 04-25-2009, 09:41 PM
  3. copying rows and inserting them between correct dates
    By assileM in forum Excel Programming / VBA / Macros
    Replies: 11
    Last Post: 09-29-2008, 12:00 AM
  4. macro inserting and copying rows
    By Guy in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 08-17-2008, 01:52 PM
  5. [SOLVED] Automatically copying fomulae when Inserting rows
    By Ian Goodhardt in forum Excel General
    Replies: 3
    Last Post: 08-17-2005, 03:05 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