Automating Insert Rows in Excel Table

I have an excel spreadsheet which refreshes its data from another source

I need to insert a blank row where the value in Column B changes

I have attached before and after sheets as examples

Paul BurrowsAsked:
Who is Participating?
NorieConnect With a Mentor VBA ExpertCommented:
Try this.
Dim ws As Worksheet
Dim I As Long

    Set ws = Worksheets("937-9 Daily Planned Transfers")
    For I = ws.Range("A" & Rows.Count).End(xlUp).Row To 2 Step -1
        If ws.Range("B" & I) <> ws.Range("B" & I - 1) Then
            ws.Range("B" & I).EntireRow.Insert
        End If
    Next I

Open in new window

Paul BurrowsAuthor Commented:
Awesome .... works a dream

Thanks very much
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.