Excel 2007. I'm having trouble setting some objects to form controls on my worksheet. Some object classes will bind, such as the combo box, but others won't. I keep getting a Type Mismatch error and I'm not sure why. See below:
[red]Run-time error '13':
Type mismatch[/red]
The code runs smoothly until I set the listbox class. But the combo box binds just fine. Other controls, such as textboxes and option buttons wont bind either. The names are correct. The problem occurs wether I'm working with form controls in a form module, or worksheet controls from within worksheet module. Why will this not work?
-JTBorton
Well, You can try banging your head against the wall, but you just end up with lost-time injuries and damaged equipment. [M. Passman]
[red]Run-time error '13':
Type mismatch[/red]
Code:
Dim cboTest As ComboBox
Dim lstList As ListBox
Dim wksRefSheet As Worksheet
Set wksRefSheet = Worksheets("Chemical Data")
Set cboTest = Worksheets("sheet2").cboTestCombo
[highlight]Set lstList = Worksheets("sheet2").lstChemicals[/highlight]
The code runs smoothly until I set the listbox class. But the combo box binds just fine. Other controls, such as textboxes and option buttons wont bind either. The names are correct. The problem occurs wether I'm working with form controls in a form module, or worksheet controls from within worksheet module. Why will this not work?
-JTBorton
Well, You can try banging your head against the wall, but you just end up with lost-time injuries and damaged equipment. [M. Passman]