ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Mouse double-click to select listbox item and run userform (https://www.excelbanter.com/excel-programming/431309-mouse-double-click-select-listbox-item-run-userform.html)

Lemi

Mouse double-click to select listbox item and run userform
 
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



RB Smissaert

Mouse double-click to select listbox item and run userform
 
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


"Lemi" wrote in message
...
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



Lemi

Mouse double-click to select listbox item and run userform
 
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

"RB Smissaert" wrote in message
...
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


"Lemi" wrote in message
...
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





RB Smissaert

Mouse double-click to select listbox item and run userform
 
Ah, yes it has! Nice and simple then.

RBS


"Lemi" wrote in message
...
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

"RB Smissaert" wrote in message
...
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


"Lemi" wrote in message
...
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







All times are GMT +1. The time now is 09:33 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
ExcelBanter.com