View Single Post
  #1   Report Post  
Posted to microsoft.public.excel.programming
Michael J. Malinsky Michael J. Malinsky is offline
external usenet poster
 
Posts: 37
Default Assigning Multiple Macros to One ComboBox Control

Private Sub UserForm_Initialize()

ComboBox1.AddItem "Item 1" 'ListIndex = 0
ComboBox1.AddItem "Item 2" 'ListIndex = 1
ComboBox1.AddItem "Item 3" 'ListIndex = 2

End Sub

Private Sub ComboBox1_Change()

Select Case ComboBox1.ListIndex
Case 0
MsgBox "Item 1 was selected"
Case 1
MsgBox "Item 2 was selected"
Case 2
MsgBox "Item 3 was selected"
Case Else
MsgBox "Error"
End Select

End Sub


--
Michael J. Malinsky


"Chas" wrote in message
...
Hi,
Need some guidance on this one.
Have a combobox with three selections. Also have three
macros, one for each combobox selection. I've tried
selecting the combobox and assigning the macro but this
only assigns one macro to the whole combobox. So only the
macro assigned runs no matter which item is selected in
the combobox.
How do I assign a different macro to each combobox
selection?

Thanks in advance for your help!
Chas