Loading
Ozgrid Excel Help & Best Practices Forums

Excel Video Tutorials / Excel Dashboards Reports



Page 1 of 2 1 2 LastLast
Results 1 to 10 of 15

Thread: Display data on user form

  1. #1
    Join Date
    8th June 2004
    Posts
    10

    Display data on user form

    Hello guys,

    Here to ask for a simple code on how can i display information on a user form once entered from an input box.

    Example

    A B C
    1 E12858 Jorge Stregan
    2 E112859 Rose Ann

    Result:

    Display all data in a row in userform once any data in A1 entered in input box.

    Thanks.

    Excel Video Tutorials / Excel Dashboards Reports


  2. #2
    Join Date
    28th January 2003
    Location
    Solihull - England
    Posts
    8,678
    See this very quick example....

    Hope it helps - the values in the two text boxes change as you tab out of the combobox...
    Attached Files. REMINDER! OzGrid accepts no responsibility for ANY adverse effects as a result from downloading attached files. ALWAYS run an up-to-date virus scan and disable macros.
    Kind Regards, Will Riley

    Web Presence:
    LinkedIn: Will Riley

  3. #3
    Join Date
    8th June 2004
    Posts
    10
    Hello WillR,

    Thanks for the code WillR. It works perfectly, but what if i want to display the data in a label not in textbox. i tried changing the code (textbox to label) but it didnt work. Its just a minor tweak but i cant figure it out.

    Excel Video Tutorials / Excel Dashboards Reports


  4. #4
    Join Date
    24th January 2003
    Location
    Australia
    Posts
    31,718
    Hi rExgiE

    To use a Label you would use code like;


    Label1.Caption="Some Text"

    Replacing Label1 with the name of your label.

  5. #5
    Join Date
    8th June 2004
    Posts
    10
    Thanks Dave,

    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.

    sample data

    A1 E12345
    B1 Jorge Estregan
    C1 14 Street Policarpio

    Result: If E12345 entered in text box, displays B1 and C1 in labels

    Thanks again in advance

    Excel Video Tutorials / Excel Dashboards Reports


  6. #6
    Join Date
    26th January 2003
    Location
    Derbyshire,UK
    Posts
    18,509
    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 
    
    
    Attached Files. REMINDER! OzGrid accepts no responsibility for ANY adverse effects as a result from downloading attached files. ALWAYS run an up-to-date virus scan and disable macros.
    Hope that Helps

    Roy

    For free Excel tools & articles visit my web site

    If I have helped you and you feel like putting your hand in your pocket please make a donation to Children in Need

    RoyUK's Web Site

    royUK's Database Form

    Where to paste code from the Forum

    About me.

  7. #7
    Join Date
    8th June 2004
    Posts
    10
    Thanks Roy,

    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.

    Please advise.

    Thanks.
    Last edited by Barbarr; October 26th, 2005 at 01:09. Reason: Add code tags

    Excel Video Tutorials / Excel Dashboards Reports


  8. #8
    Join Date
    26th January 2003
    Location
    Derbyshire,UK
    Posts
    18,509
    I will check it out. I am using Exel 2002, aand it worked before. Will post back later
    Hope that Helps

    Roy

    For free Excel tools & articles visit my web site

    If I have helped you and you feel like putting your hand in your pocket please make a donation to Children in Need

    RoyUK's Web Site

    royUK's Database Form

    Where to paste code from the Forum

    About me.

  9. #9
    Join Date
    23rd October 2005
    Posts
    6

    Re: Display data on user form

    how is it done to display all results if there are more same names for instance and i want to see all of them???

    Excel Video Tutorials / Excel Dashboards Reports


  10. #10
    Join Date
    26th January 2003
    Location
    Derbyshire,UK
    Posts
    18,509

    Re: Display data on user form

    Saban

    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.
    Hope that Helps

    Roy

    For free Excel tools & articles visit my web site

    If I have helped you and you feel like putting your hand in your pocket please make a donation to Children in Need

    RoyUK's Web Site

    royUK's Database Form

    Where to paste code from the Forum

    About me.

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Possible Answers

  1. Active Hyperlink Display on user form
    By vikrampnz in forum EXCEL HELP
    Replies: 8
    Last Post: February 9th, 2012, 10:32
  2. Search, Display, Update & Delete On User Form
    By hdevadiga in forum EXCEL HELP
    Replies: 1
    Last Post: December 12th, 2007, 09:17
  3. Macro: User Form will not display when opened
    By queenb1999 in forum EXCEL HELP
    Replies: 3
    Last Post: October 28th, 2005, 20:28
  4. User form display previous posted data
    By Bari in forum EXCEL HELP
    Replies: 4
    Last Post: January 31st, 2005, 11:33
  5. display a row or rows from an sheet on a user form
    By mjschukas in forum EXCEL HELP
    Replies: 6
    Last Post: December 6th, 2004, 15:03

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
porno