UserForm with ListBox

  • Thread starter Thread starter Otto Moehrbach
  • Start date Start date
O

Otto Moehrbach

Excel 2002, WinXP
I have a UserForm with a ListBox and OK and Cancel buttons.
I know how to deal with a selection in the ListBox when the user makes a
selection and clicks the OK button.
But sometime in the past I was able to induce code action with just the
selection of an item (multi-select set to 1) in the ListBox. IOW, there was
no OK button or a need for an OK button.
How do I do that?
Thanks for your help. Otto
 
Hi Otto,

You are looking for the "ListBox1_Click()" event
or
the "ListBox1_DblClick(ByVal Cancel As MSForms.ReturnBoolean)" event.
They are found in the form module.

Regards,
Jim Cone
San Francisco, CA
 
Otto,

You can use the Click event of the Listbox control to execute
code with the user selects an item in the list. E.g.,

Private Sub ListBox1_Click()
' your code here
End Sub



--
Cordially,
Chip Pearson
Microsoft MVP - Excel
Pearson Software Consulting, LLC
www.cpearson.com
 
Otto,

Jim's reply was better than mine. To replicate a button press,
you should use the DoubleClick event not the Click event.


--
Cordially,
Chip Pearson
Microsoft MVP - Excel
Pearson Software Consulting, LLC
www.cpearson.com
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top