Replace your current CommandButton1_Click code with the below one
Private Sub CommandButton1_Click()
Dim vFound As Variant, vSearchText As Variant
With Sheets("Changeover Form")
vSearchText = IIf(IsNumeric(TextBox1.Text), Val(TextBox1.Text), TextBox1.Text)
vFound = Application.Match(vSearchText, .Range("A:A"), 0)
If IsNumeric(vFound) Then
TextBox2.Text = Sheets("Changeover Form").Range("B" & vFound)
TextBox3.Text = Sheets("Changeover Form").Range("C" & vFound)
TextBox4.Text = Sheets("Changeover Form").Range("D" & vFound)
TextBox5.Text = Sheets("Changeover Form").Range("E" & vFound)
TextBox6.Text = Sheets("Changeover Form").Range("F" & vFound)
TextBox7.Text = Sheets("Changeover Form").Range("G" & vFound)
TextBox8.Text = Sheets("Changeover Form").Range("H" & vFound)
TextBox9.Text = Sheets("Changeover Form").Range("I" & vFound)
'TextBox10.Text = Sheets("Changeover Form").Range("J" & vFound)
TextBox11.Text = Sheets("Changeover Form").Range("K" & vFound)
TextBox12.Text = Sheets("Changeover Form").Range("L" & vFound)
Else
MsgBox "INCORRECT DATA ENTRY" & vbCrLf & vbCrLf & "Please check your PO number and try again", vbExclamation, "Palletiser Operator"
Exit Sub
End If
End With
End Sub
Bookmarks