Page 2 of 2 FirstFirst 12
Results 11 to 13 of 13

Thread: How to insert blank row after every nth row?
Thanks Thanks: 0 Likes Likes: 0

  1. #11
    Board Regular
    Join Date
    May 2010
    Location
    Cleveland, OH
    Posts
    588
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Default Re: How to insert blank row after every nth row?

    Quote Originally Posted by Trebor76 View Post
    He's name Robert then? Must be a cool guy

    Genetist, try this:
    LOL Yes, he's a Robert too. Great minds think alike as they say.

    Genetist,

    Robert's last code works as expected and with using a for loop over a do loop, it'll run faster.
    Work: Excel 2010 | Home: Apache Open Office 4.1.2
    When posting code. Please enclose your code in Code tags.
    Example:
    [code]Paste code here[/code]

  2. #12
    New Member
    Join Date
    Jan 2018
    Posts
    3
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Default Re: How to insert blank row after every nth row?

    This is what I did a few mins ago for inserting a row after every 8th, not 10th row, should work if you modify the code.

    Code:
    Sub SecRev()
        Dim insert_loop As Integer
        For insert_loop = 0 To 100
            Rows(9 + insert_loop * 9).EntireRow.Insert
            Cells(9 + insert_loop * 9, 1).Value = "SecRev"
            Cells(9 + insert_loop * 9, 2).Value = Cells(6 + insert_loop * 9, 2)
            Cells(9 + insert_loop * 9, 3).Value = Cells(6 + insert_loop * 9, 3)
        Next insert_loop
    End Sub
    Basically you have to create a 9th row, and then it gets shifted down, so instead of 17th row you need to insert 18th row, then instead of 25th row you need to insert 17th row, so on. So instead of * 8 you * 9.

  3. #13
    New Member
    Join Date
    Oct 2018
    Posts
    1
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Default Re: How to insert blank row after every nth row?

    hello,

    This code seems to be working for me. I've never worked with VBA, so I'm excited to learn. However, I need to exclude title row, and start from row 2. I dont know how to modify the code to do it. Can you please help?

Some videos you may like

User Tag List

Like this thread? Share it with others

Like this thread? Share it with others

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •