Share via

Close a combo box with vba code

Anonymous
2023-01-12T20:35:47+00:00

I am using Excel 365. I open a combo box with vba code when there is a certain value in a worksheet range with this code:

cmbccVnd.DropDown

The combobox is a field on a form. The fields on the form are saved by VBA code to a work sheet and then cleared. The problem is that the list portion of the combo box is still displayed when the save routine is finished running.

Is there any way to not display the list items of the combo box ?

Microsoft 365 and Office | Excel | For business | Windows

Locked Question. This question was migrated from the Microsoft Support Community. You can vote on whether it's helpful, but you can't add comments or replies or follow the question.

0 comments No comments

6 answers

Sort by: Most helpful
  1. Anonymous
    2023-01-13T21:16:12+00:00

    The code works fine for me.... are you fully updated?

    Was this answer helpful?

    0 comments No comments
  2. Anonymous
    2023-01-13T20:03:35+00:00

    Thanks Snow Lu MSFT but that does not work. I have tried that before this post and tried it again. Each time I get an "Unspecified Error -2147467259 (80004005

    Was this answer helpful?

    0 comments No comments
  3. Anonymous
    2023-01-13T20:02:48+00:00

    Thanks Bernie but that does not work. I have tried that before this post and tried it again. Each time I get an "Unspecified Error -2147467259 (80004005)

    Was this answer helpful?

    0 comments No comments
  4. Anonymous
    2023-01-13T08:58:36+00:00

    Hi Alex,

    Greetings! Thank you for posting to Microsoft Community.

    Here is a sample to run the main code and then clear the list item in Combox1.

    =========================

    Private Sub ComboBox1_Click()

    'Main code

    Me.ComboBox1.Clear

    End Sub

    =========================

    Best Regards,

    Snow Lu

    Was this answer helpful?

    0 comments No comments
  5. Anonymous
    2023-01-12T21:22:00+00:00

    Use code like this in the userform code to just clear the selection

    me.cbComboBoxName.Value = ""
    
    This will clear both the entry and the list:
    
    me.cbComboBoxName.Clear
    

    Was this answer helpful?

    0 comments No comments