userform to search by entering data into a textbox
Private Sub Textbox1_Exit()
Dim res as Variant, rng as Range
With worksheets("sheet1")
set rng = .Range(.Cells(1,1),.Cells(1,10.End(xldown))
End with
res = Application.Match(Textbox1.Value,rng,0)
if not iserror res then
Textbox2.Value = rng(res,2).Text
else
Textbox2.Value = "Not found"
End if
End sub
--
Regards,
Tom Ogilvy
"Moh" wrote:
Hello i have a sheet with data in column A and column B
Is there a way in creating a userform that will let me type in data in a
textbox (from column a) that will bring up information from column b
e.g A1 WILL BE LINKED TO B1
A2 WILL BE LINKED TO B2
A3 WILL BE LINKED TO B3 etc.....
so i type in a word from the column A e.g Business Department then it will
bring up a telephone Number for that Business Department from column B.
Thanks
--
please can you help... its urgent
|