If you capture all xlCellTypeConstants with the Range.SpecialCells in the Worksheet.UsedRange property , you will have several non-adjacent Scopes . They are equal to the Range.CurrentRegion property . Go through them and insert the lines as you wish.
Sub autoInsertTwoBlankRows() Dim a As Long With Worksheets("Sheet1") With .UsedRange.SpecialCells(xlCellTypeConstants) For a = .Areas.Count To 1 Step -1 With .Areas(a).Cells(1, 1).CurrentRegion .Cells(.Rows.Count, 1).Offset(1, 0).Resize(2, .Columns.Count).Insert _ Shift:=xlDown, CopyOrigin:=xlFormatFromLeftOrAbove End With Next a End With End With End Sub
If your data contains both formulas and typed constants, then this is more suitable.
Sub autoInsertTwoBlankRows() Dim a As Long, ur As Range With Worksheets("Sheet1").Cells With Union(.SpecialCells(xlCellTypeConstants), _ .SpecialCells(xlCellTypeFormulas)) For a = .Areas.Count To 1 Step -1 With .Areas(a).Cells(1, 1).CurrentRegion .Cells(.Rows.Count, 1).Offset(1, 0).Resize(2, .Columns.Count).Insert _ Shift:=xlDown, CopyOrigin:=xlFormatFromLeftOrAbove End With Next a End With End With End Sub
When inserting rows, try to work from the bottom up so that moving the rows does not affect further operations. It is for this reason that I started working with the last Region and worked on the first.

data before autoincrementTwoBlankRows data islands after autoInsertTwoBlankRows
source share