How to close activeX combobox dropdown menu on spreadsheet?

VBA_Cancer

New Member
Joined
Nov 6, 2017
Messages
17
Hi All,

I made a searchable ActiveX combo box which works as intended.

I also added a button next to it called "Add" which searches a table for whatever value is in the combo box.

Once I click the search button, the combo box automatically pulls down the dropdown menu and the only way to close it is to click on the down arrow button on the combo box.

I tried to set focus on the add button after the search but it did not work.

Code:
Sub ComboBox1_Change()

'displays search results as user type in combobox
    ComboBox1.DropDown
    
End Sub

Code:
Private Sub Add_Click()


   <code to="" search="" the="" value="">
    

'clear the combo box that is linked to this cell
    Cells(4, 3) = ""


End Sub
</code>
 

Excel Facts

Difference between two dates
Secret function! Use =DATEDIF(A2,B2,"Y")&" years"&=DATEDIF(A2,B2,"YM")&" months"&=DATEDIF(A2,B2,"MD")&" days"
try replacing Combobox1_Change with this
Code:
Private Sub ComboBox1_MouseMove(ByVal Button As Integer, ByVal Shift As Integer, ByVal X As Single, ByVal Y As Single)
    ComboBox1.DropDown
End Sub
 
Upvote 0

Forum statistics

Threads
1,224,823
Messages
6,181,181
Members
453,022
Latest member
Mohamed Magdi Tawfiq Emam

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