Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
Excell Random number
I am using the rand() function in Visual basic to find a specific number on a
list and bring up the value from 2 cells over. I have got all that but the list does not contain all number from 1 to 100. for example there is no 23 so when rand comes up with 23 the macro gets an error. is there a way in VB that if it get that error it goes to the next integer 1 higher and conditiunes that until it gets a number that works |
#2
Posted to microsoft.public.excel.programming
|
|||
|
|||
Excell Random number
You could use On Error GoTo Restart:
example: Sub Rand#() Restart: 'your regular code On Error GoTo Restart: 'execute Rand() On Error GoTo 0 End Sub "Lacoran" wrote: I am using the rand() function in Visual basic to find a specific number on a list and bring up the value from 2 cells over. I have got all that but the list does not contain all number from 1 to 100. for example there is no 23 so when rand comes up with 23 the macro gets an error. is there a way in VB that if it get that error it goes to the next integer 1 higher and conditiunes that until it gets a number that works |
#3
Posted to microsoft.public.excel.programming
|
|||
|
|||
Excell Random number
If you assign a random number to each of the used ID numbers, and sort both
by the random numbers, then you will have a random ordering of the avilable numbers. Jerry "Lacoran" wrote: I am using the rand() function in Visual basic to find a specific number on a list and bring up the value from 2 cells over. I have got all that but the list does not contain all number from 1 to 100. for example there is no 23 so when rand comes up with 23 the macro gets an error. is there a way in VB that if it get that error it goes to the next integer 1 higher and conditiunes that until it gets a number that works |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
Addding a Random number to a fixed number..... | Excel Discussion (Misc queries) | |||
How can I match a random number with closest number from sequence? | Excel Worksheet Functions | |||
same number appears in a random number generator | Excel Worksheet Functions | |||
Generating (in a random order)each number once from a given number | Excel Worksheet Functions | |||
How do I find random number in list of random alpha? (Position is. | Excel Discussion (Misc queries) |