Hi,

this is your code with the changes made to suit your needs, hope this helps.

Sub MissingNumbers()
    Dim sh As Worksheet: Set sh = Sheet1
    Dim Lr As Long: Lr = sh.Cells(sh.Rows.Count, 1).End(xlUp).Row - 1
    Dim i As Integer, r As Integer, x As Integer, xx As Integer
    Dim str_missing As String
        
        For i = 2 To Lr
            x = Val(sh.Range("A" & i + 1)) - Val(sh.Range("A" & i))
            Select Case x
                Case Is > 1
                For xx = 2 To x
                                r = r + 1
                    sh.Range("D" & r).Value = Val(sh.Range("A" & i)) + xx - 1
                    'store it in a string variable
                    str_missing = str_missing & Val(sh.Range("A" & i)) + xx - 1 & ","
                    
                Next
            End Select
        Next
        'remove the last ,
        str_missing = Left(str_missing, Len(str_missing) - 1)
        MsgBox str_missing, vbInformation
        
        'if needed you can convert this string into an array
        'Dim my_array() As String
        'my_array() = Split(str_missing, ",")
        
End Sub