Home |
Search |
Today's Posts |
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
I have a MultiSelect ListBox. I'd like to compare a VBA generated random
number with the selections in the ListBox to ensure validity. I am currently using a loop to determine if the first item in the ListBox is selected. If it is not selected, we move to the second item, etc. If it is selected then we run and If...Then statement to check the random value against the item selected in the ListBox. If the random value is not valid, a new number must be generated by VBA. If the random number is valid, then we check to ensure that the number has not been previously chosen (I use an array to store the chosen numbers). If the number has not been previously chosen, then we move on with life. If the number has already been chosen then VBA must select another random number then we must start the process over again to ensure that the new selected number is first valid against the selected items in the ListBox then checking again for a duplicate value. I was fine when I had a simple program to simply check for duplicate values. VBA selected the number then I used a separate function to check for a duplicate value. My problem started when I threw in the ListBox selection section. I can't seem to come up with a fluid method of doing what I described above. I can probably come up with the programming if someone can help with the logic. TIA Mike. -- Michael J. Malinsky |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
Prevent cell/array references from changing when altering/moving thecell/array | Excel Discussion (Misc queries) | |||
Comparing columns of text: cell value into array | Excel Discussion (Misc queries) | |||
meaning of : IF(Switch; Average(array A, array B); array A) | Excel Worksheet Functions | |||
Comparing An Array in VBA | Excel Discussion (Misc queries) | |||
return array result in cell based on comparing dates | Excel Worksheet Functions |