Mouse double-click to select listbox item and run userform

  • Thread starter Thread starter Lemi
  • Start date Start date
L

Lemi

Excel 2007 and XP Pro:
I have a UserForm with several list boxes. Normally I select items from
relevant listboxes and press OK button to continue with the macro.
Can I do the same by just double-clicking on any item of any listbox in the
Form, that is, combining list item selection and pressing OK into one
double-click?

Regards,
Lemi
 
There is no double-click event, but you could measure the time between 2
click events
or mouse-down events and make your own double-click.
How about triggering the action with a right mouse-down?

RBS
 
Hi RBS,

Thank you. However I have just found out that there was double-click event.
See below:

Private Sub ListBox1_DblClick(ByVal Cancel As MSForms.ReturnBoolean)

UserForm1.Hide 'put here exactly whatever your OK button does

End Sub

It works..
Lemi
 
Ah, yes it has! Nice and simple then.

RBS


Lemi said:
Hi RBS,

Thank you. However I have just found out that there was double-click
event. See below:

Private Sub ListBox1_DblClick(ByVal Cancel As MSForms.ReturnBoolean)

UserForm1.Hide 'put here exactly whatever your OK button does

End Sub

It works..
Lemi
 
Back
Top