See this very quick example....
Hope it helps - the values in the two text boxes change as you tab out of the combobox...
Here to ask for a simple code on how can i display information on a user form once entered from an input box.
A B C
1 E12858 Jorge Stregan
2 E112859 Rose Ann
Display all data in a row in userform once any data in A1 entered in input box.
To use a Label you would use code like;
Replacing Label1 with the name of your label.
Code is running well, instead of using combo box i changed it to textbox so i can enter data data manually. clicking a command button will search and display all data related to that on a labels. i used FIND but i find it confusing: can you enlighten me with this code.
B1 Jorge Estregan
C1 14 Street Policarpio
Result: If E12345 entered in text box, displays B1 and C1 in labels
Thanks again in advance
Try this. You will need a Textbox to enter your search, and labels for the results.The code will be triggered by the CommandButton. It searches the whole sheet
VB:Private Sub CommandButton1_Click() Dim fnd As Range ' this will be the samew as your entry in TextBox1 Dim tbl As Range ' this will be the table to search Set tbl = Sheet1.Range("A2").CurrentRegion 'run the search Set fnd = tbl.Find(What:=TextBox1.Value, After:=ActiveCell, LookIn:=xlValues, LookAt:= _ xlPart, SearchOrder:=xlByRows, SearchDirection:=xlNext, MatchCase:=False _ , SearchFormat:=False) 'if the item is not found the user is informed and the textbox cleared If fnd Is Nothing Then MsgBox "No match found!" TextBox1.Value = "" Exit Sub 'if the item is found the details will be copied to the labels Else: fnd.Activate End If 'now put the information stored adjacent to the found item into label1,etc Label1.Caption = fnd.Offset(0, 1).Value Label2.Caption = fnd.Offset(0, 2).Value 'and so on End Sub
I tried the attached file you send, but there were error on this part,
VB:Set fnd = tbl.Find(What:=TextBox1.Value, After:=ActiveCell, LookIn:=xlValues, LookAt:= _ xlPart, SearchOrder:=xlByRows, SearchDirection:=xlNext, MatchCase:=False _ , SearchFormat:=False)
The error pointed to the last part ", SearchFormat:=False)" which says "named argument not found".
Im using Excel 97.
Last edited by Barbarr; October 26th, 2005 at 00:09. Reason: Add code tags
I will check it out. I am using Exel 2002, aand it worked before. Will post back later
Welcome to Ozgrid. Would you please start a new thread for your uestion & be a little more specific on what you want. Place a link to this thread Please also include a link to this Thread. You can copy this directly from the Address bar of your Browser.
There are currently 1 users browsing this thread. (0 members and 1 guests)