+ Reply to Thread
Results 1 to 7 of 7

Inserting Rows

  1. #1
    Registered User
    Join Date
    09-11-2015
    Location
    California, usa
    MS-Off Ver
    2010
    Posts
    44

    Inserting Rows

    Hello everyone

    I am looking to insert 2 rows after each row with value in column b to the last row + 2 rows after last row with value.
    Below is what I am ultimately looking for:
    Before
    a Test1
    Test2
    Test3
    b Test4
    Test5
    Test6
    Total
    After
    a Test1


    Test2


    Test3


    b Test4


    Test5


    Test6


    Total

    Originally the following code worked prior to me adding grouping in column A and Subtotaling. Any ideas would be greatly appreciated.


    Dim myRow As Long

    myRow = 21
    Do Until Cells(myRow, 2) = ""
    If Cells(myRow, 2) = Cells(myRow - 1, 1) Then
    myRow = myRow + 1
    Else
    Cells(myRow, 1).EntireRow.Insert
    myRow = myRow + 2
    End If
    Loop

  2. #2
    Forum Expert
    Join Date
    07-31-2010
    Location
    California
    MS-Off Ver
    Excel 2007
    Posts
    4,070

    Re: Inserting Rows

    Submit your workbook.
    If you are happy with my response please click the * in the lower left of my post.

  3. #3
    Registered User
    Join Date
    09-11-2015
    Location
    California, usa
    MS-Off Ver
    2010
    Posts
    44

    Re: Inserting Rows

    Certainly, Please see attached.
    Attached Files Attached Files

  4. #4
    Forum Expert
    Join Date
    07-31-2010
    Location
    California
    MS-Off Ver
    Excel 2007
    Posts
    4,070

    Re: Inserting Rows

    Like this?

    Please Login or Register  to view this content.

  5. #5
    Registered User
    Join Date
    09-11-2015
    Location
    California, usa
    MS-Off Ver
    2010
    Posts
    44

    Re: Inserting Rows

    Close and my apologies, my attachment did not reflect that the header actually starts on row 18. How would I modify to account for this?

  6. #6
    Forum Expert
    Join Date
    07-31-2010
    Location
    California
    MS-Off Ver
    Excel 2007
    Posts
    4,070

    Re: Inserting Rows

    Change the 2 to be 19 (1 more than the header at 18)

    Please Login or Register  to view this content.

  7. #7
    Registered User
    Join Date
    09-11-2015
    Location
    California, usa
    MS-Off Ver
    2010
    Posts
    44

    Re: Inserting Rows

    Geez Okay, I feel silly for asking that follow up. Thanks so much appreciated!

+ 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. inserting blank rows between every two rows in excel
    By nazaninibb in forum Excel Formulas & Functions
    Replies: 1
    Last Post: 05-19-2015, 09:56 AM
  2. Replies: 0
    Last Post: 05-20-2014, 11:58 AM
  3. Inserting rows such that reference rows is after an automatic pagebreak
    By Tester80 in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 10-09-2013, 04:16 PM
  4. Replies: 5
    Last Post: 11-12-2008, 05:44 AM
  5. Inserting Blank rows after every row upto 2500 rows
    By Manju in forum Excel Formulas & Functions
    Replies: 8
    Last Post: 08-22-2006, 08:00 AM
  6. [SOLVED] Why is inserting rows throwing off my hidden rows
    By jgeniti in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 03-09-2006, 07:30 PM
  7. Inserting multiple rows in excel with data in consecutive rows
    By technotronic in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 10-20-2005, 11:05 AM

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