Thread: Look up
View Single Post
  #1   Report Post  
Posted to microsoft.public.excel.programming
Bob Phillips[_6_] Bob Phillips[_6_] is offline
external usenet poster
 
Posts: 11,272
Default Look up

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

--

HTH


RP
(remove nothere from the email address if mailing direct)


"Greg" wrote in message
...
What should I do for this?

I want to type a registration number in textbox1

and then have it look up the corresponding number and in textbox 2 & 3

show
firstname and surname.

for example

44 george smith

thanks in advance

Greg