Shorn Jacob
Shorn Jacob

Reputation: 1251

Excel - Display ComboBox DropDown by VBA

I need a workbook to display the Combobox List Dropdown when it opens.

The combobox in the Workbook is a form control, so a shape.

Cant seem to find the associated property.

Upvotes: 5

Views: 34048

Answers (3)

Harry S
Harry S

Reputation: 511

I consider best UserForm combo box is as Above by Siddharth Rout ComboBox1.SetFocus SendKeys "%{Down}"

for some Combo boxes on a worksheets CB.DropDown Is enough .. Just as well as they have no setfocus or activate

Upvotes: 0

Harry S
Harry S

Reputation: 511

I have had plenty of crashes with .dropdown but find some success with the SendKeys...

Upvotes: 0

Siddharth Rout
Siddharth Rout

Reputation: 149277

If you are using ActiveX Controls then see the below, else if you are using Form Controls then replace them with ActiveX Controls if you want the drop down to happen via code. The below code will work for both ActiveX Controls in a Form as well as Worksheet. If the Control is on a worksheet then change ComboBox1.SetFocus to ComboBox1.Activate

Two ways I can think of...

  • Using a simple command

Tried And Tested

Private Sub CommandButton1_Click()
   ComboBox1.DropDown
End Sub
  • Using Sendkeys. Sendkeys are unreliable if not used properly.

Tried And Tested

Private Sub CommandButton1_Click()
   ComboBox1.SetFocus
   SendKeys "%{Down}"
End Sub

SCREENSHOTS

enter image description here

Upvotes: 10

Related Questions