![]() |
ComboBox
I'm sure this is possible and is probably easy, but I can't figure it out
(I'm learning, but still have a ways to go). I have a ComboBox that has only three choices. Depending on which one you choose I'd like for it to run a macro that I've already built. How do I attach the macro based on what the user chooses? I would really appreciate any help. -- Message posted via OfficeKB.com http://www.officekb.com/Uwe/Forums.a...mming/200808/1 |
ComboBox
Assuming Combobox from the ActiveX toolbox:
Private Sub ComboBox1_Change() Call ComboBox1_Click End Sub Private Sub ComboBox1_Click() Select Case ComboBox1.ListIndex Case -1 Call Msg("nothing, nonexisting entry") Case 0 Call Msg("First choice") Case 1 Call Msg("Secong choice") Case 2 Call Msg("THird choice") Case Else Call Msg(ComboBox1.Text) End Select End Sub Sub Msg(ByRef S As String) ActiveSheet.Range("C12").Value = S End Sub HTH. Best wishes Harald "lonnierudd via OfficeKB.com" <u11209@uwe skrev i melding news:88046b7228010@uwe... I'm sure this is possible and is probably easy, but I can't figure it out (I'm learning, but still have a ways to go). I have a ComboBox that has only three choices. Depending on which one you choose I'd like for it to run a macro that I've already built. How do I attach the macro based on what the user chooses? I would really appreciate any help. -- Message posted via OfficeKB.com http://www.officekb.com/Uwe/Forums.a...mming/200808/1 |
ComboBox
Thanks!
Harald Staff wrote: Assuming Combobox from the ActiveX toolbox: Private Sub ComboBox1_Change() Call ComboBox1_Click End Sub Private Sub ComboBox1_Click() Select Case ComboBox1.ListIndex Case -1 Call Msg("nothing, nonexisting entry") Case 0 Call Msg("First choice") Case 1 Call Msg("Secong choice") Case 2 Call Msg("THird choice") Case Else Call Msg(ComboBox1.Text) End Select End Sub Sub Msg(ByRef S As String) ActiveSheet.Range("C12").Value = S End Sub HTH. Best wishes Harald I'm sure this is possible and is probably easy, but I can't figure it out (I'm learning, but still have a ways to go). I have a ComboBox that has only three choices. Depending on which one you choose I'd like for it to run a macro that I've already built. How do I attach the macro based on what the user chooses? I would really appreciate any help. -- Message posted via OfficeKB.com http://www.officekb.com/Uwe/Forums.a...mming/200808/1 |
All times are GMT +1. The time now is 02:14 AM. |
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com