Another option, without looping through every cell (inserting a range of rows and filling via series):
Sub insertRows()
Dim i As Long, lastrow As Long, tmpval as Long
lastrow = Range("A" & Rows.Count).End(xlUp).Row
Application.ScreenUpdating = False
For i = lastrow To 3 Step -1
If Cells(i, "B").Value > Cells(i - 1, "B").Value + 1 Then
tmpval = Cells(i, "B").Value - Cells(i - 1, "B").Value
Cells(i, "B").Resize(tmpval - 1, 1).EntireRow.Insert
Range(Cells(i - 1, "B"), Cells(i + tmpval - 2, "B")).DataSeries _
Rowcol:=xlColumns, Type:=xlLinear, Step:=1
End If
Next i
Application.ScreenUpdating = True
End Sub
Bookmarks