Hello
I have numbers in column A (A1:A9)
The following code extract the missing numbers and put the values in Column D
I want to change the code so as to store the values (missing numbers) in array and finally use Msgbox to list all the values once in a message
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
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
Next
End Select
Next
End Sub
Here's an attachment
Bookmarks