2
votes

I am trying to enable/disable a combobox based on the value or state of a second combobox in Excel 2007.

I think my code should look something like this:

Sub DropDown266_Change()
    If DropDown266.Index = 2 Then
        DropDown267.Enabled = False
    End If
End Sub

However, I am getting a run time error '424' saying an object is required. I am sure this is a very simple change, but I can't seem to figure it out. Let me know if you need more details.

2
Do both combo boxes exist on your form? In what line do you receive the error?Dirk Vollmar
I am assuming both combo boxes exist. When right clicking on the boxes, their respective names appear in the "Name Box" in Excel. I have tried giving them their own unique names, but the same problem persists. Is there an easy way to list all of the objects on a worksheet/workbook, similar to the "Go To" button for named cells and objects? The VBA error is on the first line, referring to DropDown266.Chase
yes the only reason for this error to surface is unavailability of the object. Can you check the name of combo you want to disable.Nilesh Deshmukh

2 Answers

1
votes

The syntax for getting the index is ComboBox1.ListIndex.

0
votes

Try using Me.DropDown266.Index

Also you can use Intellisense to check if the Combobox exists: type Me.Dro and see if DropDown266 appears in the list.