Share via

Inserting multiple blank rows between already existing rows

Anonymous
2022-12-12T18:40:35+00:00

Hi All,

I have exported a query into excel. There are 300 rows and between each one of these rows, I need 5 blank rows to add different data to. Example:

John Doe

Jane Doe

Jimmy Doe

etc...

How do I insert a set number of blank rows between each name? On a global scale. Right now, I'm just highlighting the 5 rows I need and hitting insert, as you can imagine, this is taking me A LONG time. What I need is

John Doe

Jane Doe

Jimmy Doe

Microsoft 365 and Office | Excel | Other | Other

Locked Question. This question was migrated from the Microsoft Support Community. You can vote on whether it's helpful, but you can't add comments or replies or follow the question.

0 comments No comments

Answer accepted by question author

  1. HansV 462.6K Reputation points
    2022-12-12T19:28:16+00:00

    You could run this macro:

    Sub InsertRows()
        Dim r As Long
        Dim m As Long
        Application.ScreenUpdating = False
        m = Cells.Find(What:="*", SearchOrder:=xlByRows, SearchDirection:=xlPrevious).Row
        For r = m To 2 Step -1
            Range("A" & r).Resize(5).EntireRow.Insert
        Next r
        Application.ScreenUpdating = True
    End Sub
    

    Was this answer helpful?

    1 person found this answer helpful.
    0 comments No comments

3 additional answers

Sort by: Most helpful
  1. HansV 462.6K Reputation points
    2022-12-13T21:04:09+00:00

    If you want to insert 5 blank rows below the first 100 entries, 3 below the next 50, and none further down, you can use

    Sub InsertRows()
        Dim r As Long
        Dim n As Long
        Application.ScreenUpdating = False
        For r = 150 To 2 Step -1
            Select Case r
                Case Is <= 100
                    n = 5
                Case Else
                    n = 3
            End Select
            Range("A" & r).Resize(n).EntireRow.Insert
        Next r
        Application.ScreenUpdating = True
    End Sub
    

    Was this answer helpful?

    0 comments No comments
  2. Anonymous
    2022-12-13T17:13:35+00:00

    You could run this macro:

    Sub InsertRows()
        Dim r As Long
        Dim m As Long
        Application.ScreenUpdating = False
        m = Cells.Find(What:="*", SearchOrder:=xlByRows, SearchDirection:=xlPrevious).Row
        For r = m To 2 Step -1
            Range("A" & r).Resize(5).EntireRow.Insert
        Next r
        Application.ScreenUpdating = True
    End Sub
    

    This worked beautifully, thank you.

    Side question - is it possible, out of 900 constituents, to add 5 blank lines to the first 100, then 3 blank lines for the next 50? This might be getting too complicated. I can always run 2 reports then combine.

    Anyway, this was very helpful, THANK YOU!

    Was this answer helpful?

    0 comments No comments
  3. Deleted

    This answer has been deleted due to a violation of our Code of Conduct. The answer was manually reported or identified through automated detection before action was taken. Please refer to our Code of Conduct for more information.


    Comments have been turned off. Learn more