G
Greg B
I have put the code below I use to look up a name but the problem I am
having is how do I get it to search for the next name in the list?
Private Sub TextBox1_AfterUpdate()
Sheets("customer").Select
Dim ans
On Error Resume Next
ans = Application.Match(CLng(TextBox1.Text), Range("A1:A100"), 0)
If Not IsError(ans) Then
TextBox2.Text = Application.Index(Range("B1:B100"), ans)
TextBox3.Text = Application.Index(Range("C1:C100"), ans)
TextBox4.Text = Application.Index(Range("D1100"), ans)
TextBox5.Text = Application.Index(Range("E1:E100"), ans)
TextBox6.Text = Application.Index(Range("F1:F100"), ans)
TextBox7.Text = Application.Index(Range("G1:G100"), ans)
TextBox8.Text = Application.Index(Range("H1:H100"), ans)
TextBox9.Text = Application.Index(Range("I1:I100"), ans)
Else
MsgBox "Invalid code"
End If
On Error GoTo 0
End Sub
Thanks
Greg
having is how do I get it to search for the next name in the list?
Private Sub TextBox1_AfterUpdate()
Sheets("customer").Select
Dim ans
On Error Resume Next
ans = Application.Match(CLng(TextBox1.Text), Range("A1:A100"), 0)
If Not IsError(ans) Then
TextBox2.Text = Application.Index(Range("B1:B100"), ans)
TextBox3.Text = Application.Index(Range("C1:C100"), ans)
TextBox4.Text = Application.Index(Range("D1100"), ans)
TextBox5.Text = Application.Index(Range("E1:E100"), ans)
TextBox6.Text = Application.Index(Range("F1:F100"), ans)
TextBox7.Text = Application.Index(Range("G1:G100"), ans)
TextBox8.Text = Application.Index(Range("H1:H100"), ans)
TextBox9.Text = Application.Index(Range("I1:I100"), ans)
Else
MsgBox "Invalid code"
End If
On Error GoTo 0
End Sub
Thanks
Greg