I think this will meet the added requirements.
Sub test()
Dim oneCell As Range
Set oneCell = Range("F1")
If CStr(oneCell.Value) <> "0" Then
OneCell.Insert Shift:=xlDown
Range("F1").Value = 0
Set oneCell = Range("F1")
End If
Do Until CStr(oneCell.Offset(1, 0).Value) = vbNullString
With oneCell
If Not (IsNumeric(.Value)) Or Not (IsNumeric(.Offset(1, 0).Value)) Then
MsgBox "fouled data"
Exit Sub
ElseIf (.Offset(1, 0).Value = 0 And (.Value <> 21 And .Value <> 22)) Or (.Offset(1, 0).Value = .Value + 1) Then
Rem Ok line insert nothing
ElseIf Val(.Offset(1, 0).Value) <= Val(.Value) Then
.Offset(1, 0).EntireRow.Insert shift:=xlDown
.Offset(1, 0).Value = 0
Else
.Offset(1, 0).EntireRow.Insert shift:=xlDown
.Offset(1, 0).Value = .Value + 1
End If
End With
Set oneCell = oneCell.Offset(1, 0)
Loop
End Sub
Bookmarks