Option
Explicit
Public
Sub
randomNumbers()
Dim
iRndOne
As
Integer
, iRndTwo
As
Integer
Dim
l
As
Long
Worksheets(
"Tabelle1"
).Cells.Clear
Do
l = l + 1
iRndOne = getRandomNumber
iRndTwo = getRandomNumber
With
Worksheets(
"Tabelle1"
)
.Cells(l, 1).Value = iRndOne
.Cells(l, 2).Value = iRndTwo
End
With
Loop
While
iRndOne <> iRndTwo
MsgBox
"Anzahl Durchläufe: "
& l &
"."
, vbInformation
End
Sub
Private
Function
getRandomNumber()
As
Integer
Randomize
getRandomNumber = Int((20 - 1 + 1) * Rnd + 1)
End
Function