Auto look up

G

Greg

I use this code below to look up a number in a sheet
I was wanting to extend this to be able to have both textbox1 and textbox2
to have the look up ability




Private Sub TextBox1_Enter()

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)
Else
MsgBox "Invalid code"
End If
On Error GoTo 0
End Sub

Thanks

Greg
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Similar Threads

Name look up 0
Error control? 2
Help with code please? 6
Please help with code? 2
Help with code please? 2
Advice on code 0
Help Please 0
Help with code please 1

Top