0
Private Sub ComboBox2_Change()
If Me.ComboBox2.Value <> "" Then
    Dim sh As Worksheet
    Set sh = ThisWorkbook.Sheets("nov")
    Dim i As Integer
    
    i = Application.Match(VBA.CLng(Val(Me.ComboBox2.Value)), sh.Range("A:A"), 0)
    
    Me.TextBox2.Value = sh.Range("B" & i).Value
    Me.TextBox3.Value = sh.Range("C" & i).Value
    Me.ComboBox1.Value = sh.Range("D" & i).Value
    Me.TextBox5.Value = sh.Range("E" & i).Value

End If
BigBen
  • 46,229
  • 7
  • 24
  • 40
  • 1
    `Application.Match` can return an error value. You have to test if it's an error before attempting to use its result. – BigBen Nov 12 '20 at 02:36
  • ^ Which implies that you can't assign its result to an `Integer`... you need a `Variant` and then use `IsError` to test whether it's an error. – BigBen Nov 12 '20 at 02:52

0 Answers0