
Option Explicit
Sub numeri_mancanti()
Dim minimo, massimo, Nriga, i, n_x As Long
Dim N_Numeri As Range
Set N_Numeri = Range("A3:A" & Cells(Rows.Count, 1).End(xlUp).Row)
minimo = Application.Min(Range("A3:A" & Cells(Rows.Count, 1).End(xlUp).Row))
massimo = Application.Max(Range("A3:A" & Cells(Rows.Count, 1).End(xlUp).Row))
Nriga = 3
Range("B3:B1000").ClearContents
For i = minimo To massimo
n_x = Application.Lookup(i, N_Numeri)
If i <> n_x Then
Cells(Nriga, "B") = i
Nriga = Nriga + 1
End If
Next i
Set N_Numeri = Nothing
End Sub
|
Option Explicit
Sub numeri_mancanti()
Dim minimo, massimo, Nriga, i As Long
Dim N_Numeri As Range
Set N_Numeri = Range("A3:A" & Cells(Rows.Count, 1).End(xlUp).Row)
minimo = Application.Min(Range("A3:A" & Cells(Rows.Count, 1).End(xlUp).Row))
massimo = Application.Max(Range("A3:A" & Cells(Rows.Count, 1).End(xlUp).Row))
Nriga = 3
Range("B3:B1000").ClearContents
For i = minimo To massimo
If Application.CountIf(N_Numeri, "=" & i) = 0 Then
Cells(Nriga, "B") = i
Nriga = Nriga + 1
End If
Next i
Set N_Numeri = Nothing
End Sub
|
