'Reading combobox data: Run time error '9'

I'm trying to make a form to keep track of our Toner supply by using Excel to store the data.

I'm trying to call data from Excel by reading what is in 2 combo boxes.

When I run the Name combo box alone it works but when I run the model combo box I get error 9.

Private Sub cmbName_Change() 'User changed Name combo box
    VarRow = Worksheets("Printers").Columns(1).Find(What:=Me.cmbName.Text).Row
    Me.cmbModel.Text = Sheets("Printers").Cells(VarRow, 2).Value
End Sub

Private Sub cmbModel_Change() 'User changed Name or Model combo box
    VarRow = Worksheets("PrinterModels").Columns(1).Find(What:=Me.cmbModel.Text).Row
    Me.TBBlack.Text = Sheets("PrinterModels").Cells(VarRow, 2).Value
    Me.TBCyan.Text = Sheets("PrinterModels").Cells(VarRow, 3).Value
    Me.TBMagenta.Text = Sheets("PrinterModels").Cells(VarRow, 4).Value
    Me.TBYellow.Text = Sheets("PrinterModels").Cells(VarRow, 5).Value
End Sub


Solution 1:[1]

Thank you Raymond Wu!

His comment below is the answer to my problem where I was incorrectly calling my sheets. When I ran PrinterModels.Columns(1) the error quit and the code funtioned as I wanted. Thanks again to all who commented!

"Try Worksheets("Printer Models") then, the argument given in Worksheets is the name of the worksheet, not the codename. Alternative I think you can refer to its codename by PrinterModels.Columns(1)."

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 Ian Oberdorf