How to run a macro when ComboBox value is selected

← PrevNext →

This is simple. All you have to do is, use the Change event of the ComboBox to capture the selected value and run a procedure.

run a macro when combobox value is selected in excel

Remember, the ComboBox in Excel is an ActiveX control. Its different from Excel's Drop-down List control. So, if you are looking for a Drop Down List solution, see this example.

The Macro
Option Explicit

' ComboBox change event.
Private Sub cmbCategory_Change()

    If Trim(cmbCategory.Text) <> "" Then
      Debug.Print cmbCategory.Text
    End If
End Sub

← PreviousNext →