Home |
Search |
Today's Posts |
#1
|
|||
|
|||
text box look up
I am using a userform with a textbox to look up certain surnames and give me
the people with it, I have asked before about this but the problem I am having it is only i type the name smith in the box and it comes up with the first smith in the line. How do I get it to move on until I get the one I want? I have seen in some programs you type "smith, a " and it comes up with Alice Smith or something similar. Here is the code I have been using and have been given extra, can someone give me advise on how to set it up. Private Sub TextBox7_AfterUpdate() Sheets("PRODUCTS").Select Dim ans On Error Resume Next ans = Application.Match(CLng(TextBox7.Text), Range("A:A"), 0) If Not IsError(ans) Then TextBox8.Text = Application.Index(Range("B:B"), ans) TextBox9.Text = Application.Index(Range("C:C"), ans) Else MsgBox "Invalid code" End If On Error GoTo 0 End Sub Private Sub TextBox1_AfterUpdate() Static ans As Long Dim col As Long ans = ans + 1 With Sheets("customer") For col = 1 To 0 Controls("TextBox" & col) = .Cells(ans, col).Value Next End With End Sub If anyone can help me understand it a little better it would be great. Thanks in advance Greg |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
Conditional Formatting based on Text within Text | Excel Discussion (Misc queries) | |||
SUMPRODUCT vs Text??? | Excel Worksheet Functions | |||
Autofitting a row | Excel Discussion (Misc queries) | |||
Sort or Filter option? | Excel Worksheet Functions | |||
Read Text File into Excel Using VBA | Excel Discussion (Misc queries) |