userform to search by entering data into a textbox

M

Moh

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
 
T

Tom Ogilvy

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
 
T

Tom Ogilvy

http://j-walk.com/ss/excel/tips/tip84.htm

See this tutorial here
http://www.dicks-blog.com/excel/2004/09/linking_userfor.html

XL97: How to Use a UserForm for Entering Data (Q161514)
http://support.microsoft.com/?id=161514

XL2000: How to Use a UserForm for Entering Data (Q213749)
http://support.microsoft.com/?id=213749


Here are some other sources of information:

http://www.microsoft.com/ExcelDev/Articles/sxs11pt1.htm
Lesson 11: Creating a Custom Form
Excerpted from Microsoft® Excel 97 Visual Basic® Step by Step.

Peter Aiken Articles:
Part I
http://msdn.microsoft.com/library/en-us/dnoffpro01/html/IntroductiontoUserFormsPartI.asp
Part II
http://msdn.microsoft.com/library/en-us/dnoffsol02/html/IntroductiontoUserFormsPartII.asp
 

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

Top