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
Preview:
downloadDownload PNG
downloadDownload JPEG
downloadDownload SVG
Tip: You can change the style, width & colours of the snippet with the inspect tool before clicking Download!
Click to optimize width for Twitter