Userform listbox click event fires twice

HighAndWilder

Active Member
Joined
Nov 4, 2006
Messages
391
Office Version
  1. 365
Platform
  1. Windows
I realise that this problem has been posted before by others but I have still not managed to sort it out

I have a listbox on a Userform. When an item is clicked the Click event runs twice.

When I changed it to Change it ran four times.

It is obviously a problem in Excel.

Can anybody please explain why this happens and what reliable solutions are available.

Thanks
 

Excel Facts

Whats the difference between CONCAT and CONCATENATE?
The newer CONCAT function can reference a range of cells. =CONCATENATE(A1,A2,A3,A4,A5) becomes =CONCAT(A1:A5)
What does the event code do, and how is the listbox populated?
 
Upvote 0
I have set up a simple form to try and sort this out.

I just have one listbox and when I click on an item it fires up to four times.

I have tried setting the listindex to -1 and that does not work.

VBA Code:
Private Sub ListBox1_Click()
Dim i As Integer

    MsgBox "ListBox1_Click"

End Sub

Private Sub UserForm_Initialize()
Dim i As Integer

    For i = 1 To 10
        Me.ListBox1.AddItem "Option " & i
    Next i

End Sub
 
Upvote 0

Forum statistics

Threads
1,214,518
Messages
6,119,996
Members
448,935
Latest member
ijat

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