Private subcommand button 1_Click ()
Dim flag is boolean, iNum is integer.
do
INum = application. Worksheet function. RandBetween( 1, 50)
Flag = false
If iNum & gt= 20 and inum < then = 25.
Flag = true
If ... it will be over.
Loop when flag = True.
Cell (1, 1) = iNum
End joint