How to run macro on double click of a listbox

Oliver Dewar

Board Regular
Joined
Apr 17, 2011
Messages
201
Hi All.

So I had a beautiful worksheet with 3 activex listboxes doing wonderful things on double click. Then I ran into all the horrible resizing, distorting issues associated with activex controls on different computers / screens.

I've now re-done the sheet using form control listboxes instead, and so need to assign macros that run on a double click of the listbox (as per an activex version).

Can someone help me with that code? (How to initiate a macro on double click).

It will also need to use the value of the listbox (the current selection), will .value work for a forms control as per an activex?

Now... I'd also like to give something simple back to the community here. It's fairly well known that you can't change the font size of form controls, and the font is very small! My simple workaround for this was to zoom this particular sheets in and then build around the listboxes with buttons etc at smaller font sizes and dimensions than usual... maker the listbox font bigger by comparison.

Thanks in advance for any help!
 

Excel Facts

Show numbers in thousands?
Use a custom number format of #,##0,K. Each comma after the final 0 will divide the displayed number by another thousand
A ListBox from the Forms Toolbar has only on event, which fires when you click or doubleclick an item in the list that's not currently selected. So you're out of luck I'm afraid.
 
Upvote 0
Thanks Andrew.

One idea on my part:

Could I disable the macro (or not assign one) to the listbox then put a double click event for the listbox in the worksheet module?

(If so what kind of code would I need?)
 
Upvote 0
Here is something that will emulate a double click event with a control from the Forms menu.
Code:
Sub FormsMenuDoubleClick()
    Static LastClick As Date
    
    If Now - LastClick < TimeValue("00:00:01") Then
        Range("A1") = "double clicked"
    Else
        Range("A1") = "single-clicked"
        LastClick = Now()
    End If
End Sub
Application.Timer has a 1 second "graininess" on my Mac. If Windows Timer has better resolution, using that instead of Now would be a smoother interface.
 
Last edited:
Upvote 0

Forum statistics

Threads
1,215,982
Messages
6,128,100
Members
449,420
Latest member
AussieHobbo

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