LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 37
Default Comparing a value to an array

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
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Prevent cell/array references from changing when altering/moving thecell/array nme Excel Discussion (Misc queries) 1 September 19th 08 01:53 PM
Comparing columns of text: cell value into array Myo_77 Excel Discussion (Misc queries) 0 December 5th 07 11:56 AM
meaning of : IF(Switch; Average(array A, array B); array A) DXAT Excel Worksheet Functions 1 October 24th 06 06:11 PM
Comparing An Array in VBA Greg Excel Discussion (Misc queries) 3 January 19th 06 06:31 PM
return array result in cell based on comparing dates Ruthki Excel Worksheet Functions 7 June 30th 05 11:41 PM


All times are GMT +1. The time now is 04:03 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"