Use two loops.
A do_Loop for the main column and a For..Next loop for
the gaps.
Method. Given the value of two cells a & b, the missing
numbers are any between, A...A+1...A+2...b-2...b-1
The following code assumes integers in A from row 2 and
places the missing numbers in B from row 2, assumning
headers in row 1 as per your example.
I suggest ALWAYS use Option Explicit ... it helps
debugging, and use variable names that are meaningful if
you can
Option Explicit
Sub FindMissing()
Dim ThisRow As Long ' index for the lookup column
Dim ThisValue As Long ' value if the cell at index
Dim NextValue As Long ' value of the next cell
Dim ResultRow As Long ' target row for placing result
' initialise rows
ThisRow = 2
ResultRow = 1
Do While Cells(ThisRow + 1, "A").Value <> ""
' get th ecell value and the next cell value
ThisValue = Cells(ThisRow, "A").Value
NextValue = Cells(ThisRow + 1, "A").Value
' get any missing numbers
For ThisValue = ThisValue + 1 To NextValue - 1
' increment th etarget row index
ResultRow = ResultRow + 1
' place the missing value in the result column
Cells(ResultRow, "B").Value = ThisValue
Next
' increment the loop counter
ThisRow = ThisRow + 1
Loop
End Sub
HTH
Patrick Molloy
Microsoft Excel MVP