(Solved) – VBA RemoveItem Unspecified Error for Active ComboBox


I’m getting the following error:

“Run-time error ‘-2147467259 (800040005)’:

Unspecified error.

When running the following code:

For Each cCont In Me.Controls
    If TypeName(cCont) = "ComboBox" Then
        Do While cCont.ListCount > 0 'Clear the list first
            'cCont.Selected = False
            'cCont.RowSourceType = Value
            cCont.RemoveItem (0)
    End If
Next cCont

This is placed in a general code portion of a userform. The purpose of this is to delete the items that have been added previously by sub that is triggered by a change in the field value.

This code works for other ComboBoxes that are in the same userform, but the error is thrown when it gets to the ComboBox that I have my text cursor in.

I have checked that RowSource = “” already. I’m not sure what else to try. Below is an image of the values associated with the ComboBox when the error occurs:

enter image description here

Leave a Reply

Your email address will not be published. Required fields are marked *