Selecting a listbox item event

  • Thread starter Thread starter Todd Huttenstine
  • Start date Start date
T

Todd Huttenstine

Hey

I want to have a code run when a user selects any item in my listbox
(Listbox1). How can I make this happen?


Thanks
Todd Huttenstine
 
Assuming it's a listbox on a worksheet, then right-click on it in
design mode and select 'view code' from the context menu. That will
launch the VBA IDE and create a Listbox1_Change event procedure.
 
You need to use the Click event of the ListBox. E.g.,

Private Sub ListBox1_Click()
MsgBox "You clicked: " & Me.ListBox1.Value
End Sub



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


in message
news:[email protected]...
 

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

Similar Threads

Listbox Selection 1
Listbox 8
Count number of selected item in Listbox 4
Changing specific Listbox value 5
Items in a Listbox 1
ListBox Multiple Selection 1
Listbox Scroll 2
Test for no listbox selection 1

Back
Top