Thread: Listbox Usage
View Single Post
  #1   Report Post  
Posted to microsoft.public.excel.programming
Tom Ogilvy Tom Ogilvy is offline
external usenet poster
 
Posts: 27,285
Default Listbox Usage

I suspect there is an error in the logic of the code that reorganizes the
array. This would be an easy mistake to make. Yes, redimming a 1D array to
a smaller size will drop the elements off the end

--
Regards,
Tom Ogilvy

"Marston" wrote in message
om...
Hi I have a pair of listboxes with two lists in them. The first
listbox allows for multiple selection, the second does not. The items
in the second listbox are unchanging. The user selects one or more
items in the first listbox and then one item in the second and this
sets a pairing that is used elsewhere in the code.

My problem is this. As items are selected in the first list, I remove
them from the overall list by checking in reverse order (e.g. From
UserForm.Listbox.ListCount - 1 to 0 Step -1) if an item was selected.
If it is, I then go about a loop where every item is moved up one on
the list and then the last item is set to = "". I do this in a temp
array, redimming the array after its completely looped through all the
items in the list, clearing the listbox and then setting it back up by
setting it equal to the array.
The problem is, I seem to randomly get the "" at the back end of the
listbox. Its like the array isn't redimming. If I redim a 1D array to
a smaller size, shouldn't it just drop all the items at the end?