Home |
Search |
Today's Posts |
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]() how would I write code to generate a random number only between 1-3 say with whole nubmers such as 1,2,3, 4 etc thank -- nyn0 ----------------------------------------------------------------------- nyn04's Profile: http://www.excelforum.com/member.php...fo&userid=1265 View this thread: http://www.excelforum.com/showthread.php?threadid=26231 |
#2
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Dude,
You can do something like: Sub test() MsgBox Int((30 - 1 + 1) * Rnd + 1) End Sub This will generate random numbers between 1 and 30. regards, Robert |
#3
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Also see replys under your separate thread in
microsoft.public.excel.misc. Please do not separately post the same question to multiple newsgroups. Jerry nyn04 wrote: how would I write code to generate a random number only between 1-30 say with whole nubmers such as 1,2,3, 4 etc thanks |
#4
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
nyn04
' Another way a little more random see "Randomize Statement" ' vba or vb help Private Sub Label1_Click() Dim n ' Initialize random-number generator. ' Uses the system timer Randomize ' Generate random value between 1 and in this case 30. n = Int((30 * Rnd) + 1) Label1.Caption = n End Sub Good Luck TK wrote: how would I write code to generate a random number only between 1-30 say with whole nubmers such as 1,2,3, 4 etc thanks |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
Help for Random Number Generation | Excel Worksheet Functions | |||
random number generation | Excel Discussion (Misc queries) | |||
random number generation | Excel Worksheet Functions | |||
I need help with random number generation | Excel Worksheet Functions | |||
random number generation | Excel Worksheet Functions |