Sub estrai()
Dim Riga As Double
Dim Numero As Double
Dim Diverso As Boolean
Dim Ruota(10001) As Double
Dim Minimo As Integer
Dim Massimo As Double
Dim DaEstrarre As Integer
Dim err As String
err = "Errore di input!"
Massimo = Cells(6, 4)
Minimo = Cells(5, 4)
DaEstrarre = Cells(4, 4)
Range("D3").Select
Selection.ClearContents
Range("D4").Select
If DaEstrarre > 1000 Then Cells(3, 4) = "Max. 1000": Exit Sub
If DaEstrarre < 1 Or DaEstrarre > Massimo - Minimo Then Cells(3, 4) = err: Exit Sub
If Minimo >= Massimo Then Cells(3, 4) = err: Exit Sub
Range("F:F,G:G").Select
Range("G1").Activate
Selection.ClearContents
Range("D4").Select
Cells(1, 6) = "N. progr."
Cells(1, 7) = "N. estratto"
For Riga = 2 To DaEstrarre + 1
Cells(Riga, 6) = Riga - 1
Randomize Timer
Next Riga
End Sub |