Search code examples
excelvbacombobox

DropDown a ComboBox in a sheet, NOT on a UserForm


In an Excel sheet, NOT on a UserForm - Trying to come up with a code to be able to drop down a combo box, i.e. to get it to open. Might use it to trigger with hover over a shape. But, get a "Compile error: Invalid use of Me keyword", and without "Me." get "Run-time error '424': Object required"

Sub ActivateCB1()
ActiveSheet.ComboBox1.Activate
Me.ComboBox1.DropDown
End Sub

Solution

  • Me only works in a code module attached to (eg) a worksheet or userform

    Sub ActivateCB1()
        With ActiveSheet.ComboBox1
            .Activate
            .DropDown
        End With
    End Sub