Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
Combobox
Hi All,
I have a combobox from the Form toolbar embeded on a worksheet. The combobox contains 3 items. I want to assign a seperate macro to each of these items. The macros are ready. How can I assign them? Thanks for your help. Regards |
#2
Posted to microsoft.public.excel.programming
|
|||
|
|||
Combobox
Below I am using the value of the Cell Link to trigger the
choice of which Macro to run: Sub DropDown1_Change() Select Case Sheets("Sheet1").Range("LinkedCell").Value Case 1 Call Macro1 Case 2 Call Macro2 Case 3 Call Macro3 End Select End Sub Sub Macro1() MsgBox "This is 1" End Sub Sub Macro2() MsgBox "This is 2" End Sub Sub Macro3() MsgBox "This is 3" End Sub -----Original Message----- Hi All, I have a combobox from the Form toolbar embeded on a worksheet. The combobox contains 3 items. I want to assign a seperate macro to each of these items. The macros are ready. How can I assign them? Thanks for your help. Regards . |
#3
Posted to microsoft.public.excel.programming
|
|||
|
|||
Combobox
I find that the combobox from the Control Toolbar is much better to us
than the one from the Forms toolbar. You need to add a *CASE* Statement to the *Change_Event* of th combobox. I have provided an example below. The example below assume that there are three choices in the combobox....they are the values *A B,* and *C* PRIVATE SUB COMBOBOX1_CHANGE() VSELECTION = COMBOBOX1.TEXT SELECT CASE VSELECTION CASE \"A\" MSGBOX (\"YOU HAVE SELECTED \" & \"A\") CASE \"B\" MSGBOX (\"YOU HAVE SELECTED \" & \"B\") CASE \"C\" MSGBOX (\"YOU HAVE SELECTED \" & \"C\") END SELEC Rolli -- Message posted from http://www.ExcelForum.com |
#4
Posted to microsoft.public.excel.programming
|
|||
|
|||
Combobox
Thanks. This is great. Best wishes.
-----Original Message----- Below I am using the value of the Cell Link to trigger the choice of which Macro to run: Sub DropDown1_Change() Select Case Sheets("Sheet1").Range("LinkedCell").Value Case 1 Call Macro1 Case 2 Call Macro2 Case 3 Call Macro3 End Select End Sub Sub Macro1() MsgBox "This is 1" End Sub Sub Macro2() MsgBox "This is 2" End Sub Sub Macro3() MsgBox "This is 3" End Sub -----Original Message----- Hi All, I have a combobox from the Form toolbar embeded on a worksheet. The combobox contains 3 items. I want to assign a seperate macro to each of these items. The macros are ready. How can I assign them? Thanks for your help. Regards . . |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
fill combobox depending on selection from another combobox | Excel Discussion (Misc queries) | |||
COMBOBOX | Excel Programming | |||
VBA ComboBox | Excel Programming | |||
Go To combobox | Excel Programming | |||
ComboBox | Excel Programming |