Userform listbox click event fires twice

HighAndWilder

Well-known Member
Joined
Nov 4, 2006
Messages
712
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

What is the fastest way to copy a formula?
If A2:A50000 contain data. Enter a formula in B2. Select B2. Double-click the Fill Handle and Excel will shoot the formula down to B50000.
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,224,823
Messages
6,181,181
Members
453,022
Latest member
Mohamed Magdi Tawfiq Emam

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