ListBox Click event not working

dinamike1

New Member
Joined
Nov 24, 2006
Messages
11
I currently have a set of ListBox controls on a worksheet tab. They are all configured as multi-select and i have the values populated via the ListFillRange properties. Each listbox has an '{All}' option; when the user clicks on this value I want to de-select all other previously selected values. The code for this is straightforward enough, but I cannot get it to fire using the _Click event. Does anyone know why this is not working?

Additionally, I attempted to use the _Change event but quickly got caught in recursive loops which obviously is not going to cut it.
 
I know this is a very old thread, but I thought I may have a solution for anybody searching with regard to this issue.

I recently laid a listbox on a modal form, which I populated from its calling form before showing it. The listbox is set as multiselect and with the list style set as 'Option' (which
change to check boxes in multi-select).

My code was simply to check what was in the second column, if it contained a certain phrase (the calling code ensured any such listitem was pre-selected), then if the user tried
to deselect, it would simply reselect. Any items without the phrase could be selected on or off at will.

Fine, but the Click event didn't fire!

So here's my kludge - sorry, I mean fix.

1/ In the Form.Activate event I placed - Application.EnableEvents = True
(and no, that did not fix the click firing event, BUT:-

2/ I shifted my click event code into the Mouse Up event and it all worked great!

Note: In my case it had to be the Mouse Up event, not the Mouse Down event (both would now fire - but not the Click ??) - as ListIndex retains the previous setting during the Down
event (which kind of makes sense), it's only until the mouse button is released that the ListIndex is shifted to the NOW selected item.

Anyway, this may help somebody another nine years into the future (blimey, wonder if I'll still be around?)
Regards BB
 
Upvote 0

Excel Facts

Create a chart in one keystroke
Select the data and press Alt+F1 to insert a default chart. You can change the default chart to any chart type

Forum statistics

Threads
1,223,227
Messages
6,170,848
Members
452,361
Latest member
d3ad3y3

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