ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Spinning Numbers (https://www.excelbanter.com/excel-programming/286358-spinning-numbers.html)

Michael[_23_]

Spinning Numbers
 
Thanks to Rocky for the following Macro to select and spin
a random number for a raffle. However, a couple of
questions. Will the routine include 1 and 100 in the draw
and secondly can any numbers be input ie, 87000 to 87500
Regards
Michael

Option Explicit
Declare Sub Sleep Lib "kernel32" (ByVal dwMilliseconds As
Long)
Sub SpinNumber()
Dim X As Integer
For X = 1 To 99
Range("I8") = Int((100 * Rnd) + 1)
Sleep 10
Next X
End Sub



losmac[_2_]

Spinning Numbers
 
To randomize range of numbers use it:

Sub SpinNumber_1()
'Int((up_number - down_number + 1) * Rnd + down_number)
Dim X As Integer
For X = 1 To 20
Range("I" & X) = Int((87500 - 87000 + 1) * Rnd +
87000)
Sleep 10
Next X
End Sub

-----Original Message-----
Thanks to Rocky for the following Macro to select and

spin
a random number for a raffle. However, a couple of
questions. Will the routine include 1 and 100 in the draw
and secondly can any numbers be input ie, 87000 to 87500
Regards
Michael

Option Explicit
Declare Sub Sleep Lib "kernel32" (ByVal dwMilliseconds As
Long)
Sub SpinNumber()
Dim X As Integer
For X = 1 To 99
Range("I8") = Int((100 * Rnd) + 1)
Sleep 10
Next X
End Sub


.



All times are GMT +1. The time now is 10:20 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com