Sub Tombola()
Dim Aleatorio As Integer, plage As Range, x As Integer
Set plage = Sheets("Hoja2").Columns(1)
With Sheets("Hoja2").Columns(1)
x = WorksheetFunction.CountA(plage)
If x > 0 Then
Aleatorio = WorksheetFunction.RandBetween(1, x)
Range("C7") = .Range("A" & Aleatorio).Value
.Range("A" & Aleatorio).EntireRow.Delete
Else
MsgBox "Se han acabado los números"
.Cells(1, 1).Value = 1
.DataSeries xlColumns, Stop:=30
End If
End With
End Sub
Sub Tombola()
Dim Aleatorio As Integer, plage As Range, x As Integer
Set plage = Sheets("Hoja2").Columns(1)
With Sheets("Hoja2").Columns(1)
x = WorksheetFunction.CountA(plage)
If x > 0 Then
Aleatorio = WorksheetFunction.RandBetween(1, x)
Range("C7") = .Range("A" & Aleatorio).Value
.Range("A" & Aleatorio).EntireRow.Delete
Else
MsgBox "Se han acabado los números"
.Cells(1, 1).Value = 1
.DataSeries xlColumns, Stop:=30
End If
End With
End Sub