Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
UserForm ListBox Events
Greetings,
I have a multi-column ListBox whose list is determined by a number of optionButtons: oBtn_click() Build array from worksheet range Load list with array loop through list and set .selected property for each item according to saved settings on worksheet End Sub If user then makes selection changes in list then update worksheet range where .selected status for each item is saved. (although this idea seems a bit wasteful if the user makes a number of changes before exiting the list, I thought I would settle for it until something better turned up) To determine whether the user made a selection change I tried the listBox.change event. Of course, I then found that the initial setting of ..selected for each list item in oBtn_click() procedure also fired the ListBox.change event, which would screw things up. After trying the ListBox_click event and getting nowhere, I eventually came up with adding 2 lines to the oBtn_click() ## initialisingSelections = False loop through list and set .selected property for each item according to saved settings on worksheet ## initialisingSelections = True Then with the ListBox_change(): If not initialisingSelections then run code to save new selections in worksheet End If End Sub I thought this approach, although it works, is a bit clumsy. Ideally I think I should be saving the .selected status of each item when the user either changes lists or exits the UserForm. Any advice on logic or choice of events to use would be much appreciated. TIA -- David |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
Help with listbox control events | Excel Programming | |||
Multipage Userform Events | Excel Programming | |||
Events for controls created on the fly on a userform | Excel Programming | |||
UserForm events | Excel Programming | |||
UserForm Events | Excel Programming |