Listbox has some items selected when userform containing it opens.
I was about to post a question about this same kind of thing.
I have tried all the same kinds of ideas to keep the List box from
populating the listindex by itself too.
I noticed that the strange behavior seems to occur when the double-clicked
cell being used to launch the event just happened to be in the exact same
area as where the mouse would be positioned to select a choice from the
listbox. It seems like the 2nd click of the initial double click is also
being registered as the single click to select an item. (Tom, can you verify
if your issues arrise from the same kind of mouse to listbox item positioning
on the screen?)
I have attempted to put a short delay-loop before the double-click event
code executes the .show for the form. but it still didn't stop it from
happening.
Any thoughts on what to try next?
--
Regards,
John
"Tom" wrote:
Sorry if this has allready been addressed. I could not find this specific
issue anywhere.
It sounds strange but multi-select listboxs inside userforms called by
double-clicking on different ranges of cells will sometimes open with items
(the same items when it does it) already selected. The real strange part is
that it seems to be linked to the width and/or height of the cells in and
arround the ranges. I.e. if I change the width of the column next to the
range that triggers the form, sometimes the pre-selection stops. But then it
may start in another userform-listbox (I have 5 set up based on different
columns being double-clicked). The listbox is loaded from dynamic named
range on another worksheet via its "RowSource" property. I've tried clearing
the list when form is initialized, AfterUpdate for Listbox, BeforeUpdate for
list box, .... I've even tried loading the listbox from an array instead of
the dynamic named range.... but still get same issue. The only way I can
clear the selections is manually clicking on them or having a control button
set up to clear the selections when pressed.
Is there some way to make sure listbox selections are cleared when form is
called?
Thanks
|