views:

178

answers:

3

Hi all,

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.

Thanks, Chase

+1  A: 

Are you sure DropDown267 exists?

Tomalak
As noted above, yes - I am sure that DropDown267 exists.
Chase
@Chase: It was just a question. ;) Sometimes one does not see the obvious. On which line does the error occur?
Tomalak
A: 

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.

Charles Williams
A: 

Chase... The syntax for getting the index is ComboBox1.ListIndex, I am not sure if thats because I am using Excel 2003, can you try it at your end.

Cheers... Nilesh

Nilesh Deshmukh