This code displays the correct value in Textbox1...
But the remaining textboxes display values from the last used row of the datasheet. What am I doing wrong?
But the remaining textboxes display values from the last used row of the datasheet. What am I doing wrong?
Code:
Private Sub ComboBox1_Change()
Dim x&
With Sheets("Sheet1")
For x = 1 To .Cells(Rows.Count, "D").End(xlUp).Row
If .Cells(x, "D").Value = Me.ComboBox1.Value Then _
Me.TextBox1.Value = .Cells(x, "F").Value
Me.TextBox2.Value = .Cells(x, "G").Value
Me.TextBox3.Value = .Cells(x, "H").Value
Me.TextBox4.Value = .Cells(x, "I").Value
Me.TextBox5.Value = .Cells(x, "J").Value
Next x
End With
End Sub