Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1,560
Default 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
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
Help with listbox control events TrendyProgrammer Excel Programming 3 July 11th 05 06:07 PM
Multipage Userform Events SA3214 Excel Programming 7 April 13th 05 09:03 PM
Events for controls created on the fly on a userform John Austin[_3_] Excel Programming 3 March 7th 05 04:23 PM
UserForm events R Avery Excel Programming 5 August 19th 04 05:59 PM
UserForm Events Nigel[_6_] Excel Programming 1 February 22nd 04 12:19 PM


All times are GMT +1. The time now is 10:36 PM.

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

About Us

"It's about Microsoft Excel"