Userform listbox - change event

Formula11

Active Member
Joined
Mar 1, 2005
Messages
468
Office Version
  1. 365
Platform
  1. Windows
How can a change event be captured in a list box, when you re-select the same item.

In this case, there are 2 list boxes.
1. After selecting an item in the first listbox, there is a change event. OK.
2. Then select an item in the second listbox, there is a change event. OK.
3. If I go back to the first, select the same item, there is no change event.

How can 3. be solved?

1677393133828.png



VBA Code:
Private Sub ListBox1_Change()
    MsgBox "changed 1"
End Sub

Private Sub ListBox2_Change()
    MsgBox "changed 2"
End Sub
 

Excel Facts

Test for Multiple Conditions in IF?
Use AND(test, test, test, test) or OR(test, test, test, ...) as the logical_test argument of IF.
Use click event instead (or also)? If you re-select the same selected item, there is no change.
 
Upvote 0
Thanks, but the click event didn't work.
I'll look into it further.
 
Upvote 0
Both the Change and the Click event of a Listbox requrie a new item to be selected. One workaround that will react to an item being selected again would be to use the MouseUP event.
 
Upvote 0
Solution

Forum statistics

Threads
1,224,823
Messages
6,181,178
Members
453,021
Latest member
Justyna P

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