+ Reply to Thread
Results 1 to 6 of 6

How to search record from sheet & display it to UserForm.

  1. #1
    Registered User
    Join Date
    06-25-2013
    Location
    Pakistan
    MS-Off Ver
    Excel 2007
    Posts
    2

    How to search record from sheet & display it to UserForm.

    Hello,


    I am very new to VBA

    I need code for this attachment userform...In this userform I have three category Date,Payment received,Payment Due

    What I want is that if ID has been put in the "Enter ID" textbox

    In the textboxes below in the userform it should display all related records of that ID of only columns of DATE, PAYMENT RECEIVED and PAYMENT DUE

    ...For example like the data in the Sheet1, If ID 1 has been put in the userform textbox it should display

    21-Jan-13 ===== 1000===== 500
    24-Jan-13 ===== 200 ===== 300
    28-Feb-13 ==== 200 ===== 100

    I hope you would be unterstood what I mean.


    I will be very thankful ...please help
    Attached Files Attached Files

  2. #2
    Forum Moderator Leith Ross's Avatar
    Join Date
    01-15-2005
    Location
    San Francisco, Ca
    MS-Off Ver
    2000, 2003, & 2010
    Posts
    23,259

    Re: How to search record from sheet & display it to UserForm.

    Hello Mr82,

    Welcome to the Forum!

    I replaced the Text Boxes with a single ListBox. This will allow you to display all records found matching the ID and simplify your code. have a look and let me know what else you want to do.

    UserForm Code
    Please Login or Register  to view this content.
    Attached Files Attached Files
    Sincerely,
    Leith Ross

    Remember To Do the Following....

    1. Use code tags. Place [CODE] before the first line of code and [/CODE] after the last line of code.
    2. Thank those who have helped you by clicking the Star below the post.
    3. Please mark your post [SOLVED] if it has been answered satisfactorily.


    Old Scottish Proverb...
    Luathaid gu deanamh maille! (Rushing causes delays!)

  3. #3
    Registered User
    Join Date
    02-22-2013
    Location
    pakistan
    MS-Off Ver
    Excel 2007
    Posts
    89

    Re: How to search record from sheet & display it to UserForm.

    Hi Leith Ross,


    Thanks very much for your help....Actually I have two worksheets and the data is on my Sheet2 (named "Payment Records") and UserForm button is on Sheet1.

    Can you please tell me what changes should I made in your code to catch the data from Sheet2 to display in Userform List Box.


    Thank you.
    Regards
    Mr82

  4. #4
    Forum Moderator Leith Ross's Avatar
    Join Date
    01-15-2005
    Location
    San Francisco, Ca
    MS-Off Ver
    2000, 2003, & 2010
    Posts
    23,259

    Re: How to search record from sheet & display it to UserForm.

    Hello z-eighty2,

    Just need to prefix the range with the worksheet it belongs to. Here is the amended code:
    Please Login or Register  to view this content.

  5. #5
    Forum Contributor
    Join Date
    07-16-2012
    Location
    Fort Worth, Texas
    MS-Off Ver
    Excel 2010
    Posts
    378

    Re: How to search record from sheet & display it to UserForm.

    Hello,

    I'm reading this post and I'm very interested. Is there a way that you could write additional code for the ListBox2 to enter either ID or the Date and display all the information based on either ID or Date.

  6. #6
    Registered User
    Join Date
    02-22-2013
    Location
    pakistan
    MS-Off Ver
    Excel 2007
    Posts
    89

    Re: How to search record from sheet & display it to UserForm.

    Hi Leith Ross,

    Thanks very much for your kind help.......This code really works for me....this was the code which I was looking for......

    Thanks once again

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

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

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1