#1   Report Post  
Greg B
 
Posts: n/a
Default 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
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Conditional Formatting based on Text within Text George Lynch Excel Discussion (Misc queries) 3 May 5th 05 07:58 PM
SUMPRODUCT vs Text??? Ken Excel Worksheet Functions 2 April 9th 05 07:21 PM
Autofitting a row Josephine Excel Discussion (Misc queries) 2 March 3rd 05 03:37 PM
Sort or Filter option? Mcobra41 Excel Worksheet Functions 3 February 23rd 05 07:22 PM
Read Text File into Excel Using VBA Willie T Excel Discussion (Misc queries) 13 January 8th 05 12:37 AM


All times are GMT +1. The time now is 12:35 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"