listbox selection behaviour

RuudS

New Member
Joined
Oct 28, 2022
Messages
2
Office Version
  1. 2021
Platform
  1. Windows
I use a userform with also two listboxes. The user is asked to fill some textboxes, select items in comboboxes en select items in those two listboxes (no specific order required).
When a user wants to select an item in one listbox it is done with just one click. So starting of, lets say, a combobox, it only requires one click te select an item in that listbox. To do the same in the other listbox a user has to do two clicks. It seems like it is first necessary to select the listbox before an item can be selected. I cannot find what causes this difference. Both listboxes seem to be similar.

Any hints where this can come from and what to do?
 

Excel Facts

How to change case of text in Excel?
Use =UPPER() for upper case, =LOWER() for lower case, and =PROPER() for proper case. PROPER won't capitalize second c in Mccartney
This seems like a bit of a stretch but check the tab order and the tab stop properties of the 2 listboxes. Or is this only about mouse clicks and not tab key? I agree, seems like the first click is required to set the focus. Unless there is code involved that's messing up the behaviour that's all I can think of at the moment.
After the first listbox choice is made, watch to see if focus jumps to some other form control. That might provide other clues.
 
Upvote 0
I use a userform with also two listboxes. The user is asked to fill some textboxes, select items in comboboxes en select items in those two listboxes (no specific order required).
When a user wants to select an item in one listbox it is done with just one click. So starting of, lets say, a combobox, it only requires one click te select an item in that listbox. To do the same in the other listbox a user has to do two clicks. It seems like it is first necessary to select the listbox before an item can be selected. I cannot find what causes this difference. Both listboxes seem to be similar.

Any hints where this can come from and what to do?
Hello

include the following in your Userform Initialize code:

me.listbox1.SetFocus

this should solve your problem.

Cheers
 
Upvote 0
Thank you both. I didn't figure out how to change this. @Micron It's is about mouse clicks. I checked tab order. There is nothing strange . After changing it, the issue remains.
@robertvdb Set focus doesn't change it. In trying this I even more think that there are 2 'levels' of focus (the listbox as a whole and the set of items within the listbox). The strange thing is that the two listboxes to me are the same, but behave differently.
By the way: A rigid order of focussing wouldn't be my preference.
 
Upvote 0

Forum statistics

Threads
1,214,887
Messages
6,122,095
Members
449,064
Latest member
Danger_SF

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top