Limit the number of values in a Multi Select list box

  • Thread starter Thread starter Sandy
  • Start date Start date
S

Sandy

Hi
Can anyone tell me how to limit the number of selections a
user can make in a multiselect list box.

I know how to count them and I want to stop the users from
selecting more than 5 values at a time.

Thanks in advance
Sandy
 
This is to lengthy to give code example but you can find example in online
VBA help. search for listbox and view "selected" property. create a loop
that counts the selected items with the click event of the control. when it
reaches 5 either run the code or action you desire or simply set the locked
property to true which will prevent the user from selecting anymore items.
maybe move the focus to the next control or command button to process the
selected items.
HTH
 
Back
Top