View Single Post
  #1   Report Post  
Posted to microsoft.public.excel.programming
Nigel[_2_] Nigel[_2_] is offline
external usenet poster
 
Posts: 735
Default ListBox Conundrum

Hi All

I thought I knew how to manage UserForm listboxes. But clearly not !

On a user form I have a list box that is refreshed from another action. A
user can double-click an item in the list, which causes the list to be
reloaded, the number of items in the refreshed list may change but the item
that was double-clicked will remain but its position may differ.

I had set up some code that records the item chosen and then re-applies this
by setting the ListIndex to the right location. The value generated is
correct but the item is not being selected. It is as if the ListIndex value
is being ignored. The actual and wrong item selected is fixed by the
physical location of the original selected item in the list. Hope this
makes sense.

How do I eliminate the current selection before I reapply my new ListIndex
value? I tried setting the ListIndex to -1 first but that does not work.
Do I need to redraw or something else?

TIA



--

Regards,
Nigel