Combobox with macro on selecting items

drop-down-menu, excel, vba

Solution

Paste this code in a module. The Right Click on the Combobox and assign the macro `DropDown1_Change` to it :) And you are done.

Option Explicit

Sub DropDown1_Change()
    With ThisWorkbook.Sheets("Sheet1").Shapes("Drop Down 1").ControlFormat
        Select Case .List(.Value)
            Case "Birgitte": BS_Opgave
            Case "Thomas": TR_Opgave
        End Select
    End With
End Sub

Sub BS_Opgave()
    MsgBox "You selected Birgitte"
End Sub

Sub TR_Opgave()
    MsgBox "You selected Thomas"
End Sub

ASSUMPTIONS

I am assuming the following

- The name of the combobox is "Drop Down 1"

- The combobox is in "Sheet1"

Problem

I'm very new to VBA and i searched and searched on Google, but can't find an example which deals with my problem. I got a list of names which I want to put inside a selectable dropdownlist. When i click their name I want to run a different macro i made with their name on. I tried a lot of things yesterday, but everytime it only succed me to assign 1 macro which was called no matter which name i pressed. I think the solution is pretty simple, but i really got no clue how to do this the most simple way. So hopefully any of you got a link to a simple tutorial or can explain it to me in steps. Thanks in advance EDIT: I got 2 names. Birgitte = A:1 Thomas = A:2 I got a form comboxbox where both names are in. When i press Birgitte i want a macro called BS_Opgave() to run and when i pres Thomas i want Macro TR_Opgave to run. My problem is I'm not sure how to connect the combox selection to a Macro in the VBA editor. I'm acutyally confused about everything in the editor about comboxing.

Original source