More macros to Listbox Items

I can assign a Macro to a control Listbox, how can I assign a Macro to each item of the control listbox?
Thanks

Almir's picture

Try this

Re

Sorry, not yet, i'm missing something: i would like to create macro1 macro2 items in a control listbox and if i double click on macro1 call macro1 if i double click on macro2 call macro2
At the moment whatever item i click it calls me macro1 and also if i change the name to the items it calls me macro1, never macro2. I assigned the following macro to the control listbox. what is wrong?

Sub ListBox1_Change()
'Dim Listbox1 As ListBox
'Set Listbox1 = Sheet1.ListBoxes("List box 7")

Select Case Listbox1

Case Listbox1 = "Test"
Call Macro1
Case Listbox1 = "Tast"
Call Macro2

End Select
End Sub

Almir's picture

I have changed the code a bit. Check it now.

I have changed a code a bit. Check it now. There is also an example file attached at:

http://excelexperts.com/solution-listbox-change-calls-different-macros

Almir's picture

I have changed the code a bit. Check it now

I have changed a code a bit. Check it now. There is also an example file attached at:

http://excelexperts.com/solution-listbox-change-calls-different-macros

re

works fine with Active X Listbox
thank you

Almir's picture

Listbox value change calls a different macro

Glad to help you.