+ Reply to Thread
Results 1 to 12 of 12

Adding two rows after every existing row

  1. #1
    Forum Contributor
    Join Date
    03-16-2007
    Location
    Berlin, Germany
    MS-Off Ver
    Excel 2007
    Posts
    202

    Adding two rows after every existing row

    Hi all

    Is there any way to automatically add two new rows after every existing row containing data?

    For example

    1 A B C
    2 D E F
    3 G H I

    turn into

    1 A B C
    (empty row)
    (empty row)
    2 D E F
    (empty row)
    (empty row)
    3 G H I


    Thanks!

  2. #2
    Forum Expert JBeaucaire's Avatar
    Join Date
    03-21-2004
    Location
    Bakersfield, CA
    MS-Off Ver
    2010, 2016, Office 365
    Posts
    33,492

    Re: Adding two rows after every existing row

    Try this out:
    Please Login or Register  to view this content.
    _________________
    Microsoft MVP 2010 - Excel
    Visit: Jerry Beaucaire's Excel Files & Macros

    If you've been given good help, use the icon below to give reputation feedback, it is appreciated.
    Always put your code between code tags. [CODE] your code here [/CODE]

    ?None of us is as good as all of us? - Ray Kroc
    ?Actually, I *am* a rocket scientist.? - JB (little ones count!)

  3. #3
    Registered User
    Join Date
    08-15-2008
    Location
    denver
    Posts
    68

    Re: Adding two rows after every existing row

    If you're looking for a lower-tech solution, try this:

    In an empty column, sequentially number your existing rows. Copy that number sequence below below your original sequence, in the same column, then copy it a second time below that. Add a fraction, say .1, to the copied number sequences (not to your original sequence).

    Then sort your spreadsheet by the new column. It should be sorted as 1, 1.1, 1.1, 2, 2.1, 2.1, 3, etc. Delete your sequence column, and you're there.

  4. #4
    Forum Expert JBeaucaire's Avatar
    Join Date
    03-21-2004
    Location
    Bakersfield, CA
    MS-Off Ver
    2010, 2016, Office 365
    Posts
    33,492

    Re: Adding two rows after every existing row

    Quote Originally Posted by jmhultin View Post
    Add a fraction, say .1, to the copied number sequences (not to your original sequence).

    Then sort your spreadsheet by the new column.
    That's a standard manual technique and a very good suggestion, Hitch, if you prefer. However, you don't need to increment the values. Just copy the numeric sequence twice below the original sequence and sort. The blank rows will be below the original since the sort would be from the top down.

  5. #5
    Forum Contributor
    Join Date
    03-16-2007
    Location
    Berlin, Germany
    MS-Off Ver
    Excel 2007
    Posts
    202

    Re: Adding two rows after every existing row

    Very simple, I like it

    Thanks a lot!!

  6. #6
    Forum Expert JBeaucaire's Avatar
    Join Date
    03-21-2004
    Location
    Bakersfield, CA
    MS-Off Ver
    2010, 2016, Office 365
    Posts
    33,492

    Re: Adding two rows after every existing row

    If that takes care of your need, be sure to EDIT your original post, click Go Advanced and mark the PREFIX box [SOLVED].


    (Also, use the blue "scales" icon in our posts to leave Reputation Feedback, it is appreciated)

  7. #7
    Registered User
    Join Date
    12-03-2008
    Location
    The Swamp
    MS-Off Ver
    2000 Pro
    Posts
    75

    Re: Adding two rows after every existing row

    Found this on page 11....

    Can someone explain to me how to add the code to a worksheet?

    Thanks

  8. #8
    Forum Expert JBeaucaire's Avatar
    Join Date
    03-21-2004
    Location
    Bakersfield, CA
    MS-Off Ver
    2010, 2016, Office 365
    Posts
    33,492

    Re: Adding two rows after every existing row

    Georgia, as a rule, you should always post your own question in your own thread with an appropriately accurate title, then include IN your post links to these other threads you may be referring to.

    ========
    Since I should probably have included these instructions anyway:

    How to use the macro:

    1. Open up your workbook
    2. Get into VB Editor (Press Alt+F11)
    3. Insert a new module (Insert > Module)
    4. Copy and Paste in your code (given above)
    5. Get out of VBA (Press Alt+Q)
    6. Save your sheet

    The macro is installed and ready to use. Press Alt-F8 and select it from the macro list.

  9. #9
    Registered User
    Join Date
    12-03-2008
    Location
    The Swamp
    MS-Off Ver
    2000 Pro
    Posts
    75

    Re: Adding two rows after every existing row

    Sorry about that, will do for the future.

    When I follow your instructions, then try to run the macro, it says

    "invalid outside procedure"

  10. #10
    Forum Expert JBeaucaire's Avatar
    Join Date
    03-21-2004
    Location
    Bakersfield, CA
    MS-Off Ver
    2010, 2016, Office 365
    Posts
    33,492

    Re: Adding two rows after every existing row

    Georgia, please start your own thread. Post your workbook in that thread if needed.

  11. #11
    Registered User
    Join Date
    10-14-2013
    Location
    Philippines
    MS-Off Ver
    Excel 2010
    Posts
    1

    Re: Adding two rows after every existing row

    thanks for sharing the solution! very simple and effective

  12. #12
    Registered User
    Join Date
    06-02-2013
    Location
    Adelaide, Australia
    MS-Off Ver
    Excel 2010
    Posts
    16

    Re: Adding two rows after every existing row

    Future Googler's may find the attached spreadsheet takes jmhultin's super simple solution and builds on it by making it super fast to do.

    Insert as many rows as you want into your table (or just 1 column of data) in seconds. If you want to keep the macro's disabled because you don't trust the internets, just follow the instructions and then sort on column D. You'll get the same basic result, the macro just cleans up the worksheet a bit afterwards.

    Thanks to jmhultin for giving such a good solution!
    Attached Files Attached Files
    Last edited by Bobneil; 10-15-2014 at 03:11 AM.

+ 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