vba for combox and select the switch case

Azhar0554

New Member
Joined
Oct 16, 2017
Messages
10
Hi Guys,

I have a function on Module.I'm planning to have a ActiveX combobox on sheet 1 with a list of values(ie : 1-1s etc) when the user selects any value that should trigger/invoke a function below is my code.



Private Sub ComboBox1_Change()




Set comboVal = ??



Select Case comboVal.Value


Case "1-1s"
Call scenario1
Case "2-1s"
Call scenario2
Case "3-1s"
Call scenario3
Case "6-2s"
Call scenario4
End Select
End Sub
 

Excel Facts

How can you automate Excel?
Press Alt+F11 from Windows Excel to open the Visual Basic for Applications (VBA) editor.
Code:
[color=darkblue]Private[/color] [color=darkblue]Sub[/color] ComboBox1_Change()
    [color=darkblue]Select[/color] [color=darkblue]Case[/color] [B]ComboBox1.Value[/B]
        [color=darkblue]Case[/color] "1-1s"
            [color=darkblue]Call[/color] scenario1
        [color=darkblue]Case[/color] "2-1s"
            [color=darkblue]Call[/color] scenario2
        [color=darkblue]Case[/color] "3-1s"
            [color=darkblue]Call[/color] scenario3
        [color=darkblue]Case[/color] "6-2s"
            [color=darkblue]Call[/color] scenario4
    [color=darkblue]End[/color] [color=darkblue]Select[/color]
[color=darkblue]End[/color] [color=darkblue]Sub[/color]
 
Upvote 0

Forum statistics

Threads
1,215,184
Messages
6,123,533
Members
449,106
Latest member
techog

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top