How to automatically insert a blank row after a group of data based on column selected by the User - i.e. active cell

PHOTO EMBED

Wed Sep 08 2021 04:49:49 GMT+0000 (Coordinated Universal Time)

Saved by @cnewnham #vba

Sub AddBlankRows_RangeSelectedbyUser() 'How to automatically insert a blank row after a group of data based on column selected by the User - i.e. active cell
'
Dim iRow As Integer, iCol As Integer
Dim oRng As Range

Set oRng = Application.Selection 'Sets range (in this case the column) as the user selected range - I.e. this is what application.selection does

iRow = oRng.Row
iCol = oRng.Column

Do
'
If Cells(iRow + 1, iCol) <> Cells(iRow, iCol) Then
    Cells(iRow + 1, iCol).EntireRow.Insert Shift:=xlDown
    iRow = iRow + 2
Else
    iRow = iRow + 1
End If
'
Loop While Not Cells(iRow, iCol).Text = ""
'
End Sub
content_copyCOPY