+ Reply to Thread
Results 1 to 11 of 11

Find the rows in excelsheet and pop up listbox with those rows

  1. #1
    Forum Contributor
    Join Date
    02-20-2009
    Location
    bristol
    MS-Off Ver
    Excel 2003
    Posts
    882

    Find the rows in excelsheet and pop up listbox with those rows

    Hi guys

    I want to design a search form in excel that will lokk for the values in excelsheet and when match occurs then pop up those rows in listbox in the form. There are different criterias: one is Client_no or Policy_no ,If the person knows this no then he can simply type it in the textnox and press search and then the matching row will be displayed in listbox. If the user doesn't know the policy_no then he can try other things in the frame e.g First name,Last name,any part of address(so hopefully we'll use like operator here),Postcode.Please find attached excel file and please can anyone give me the code to do this.

    Regards,
    Aman
    Attached Files Attached Files

  2. #2
    Forum Contributor
    Join Date
    04-18-2009
    Location
    Mumbai, India
    MS-Off Ver
    Excel 2016
    Posts
    269

    Re: Find the rows in excelsheet and pop up listbox with those rows

    I have written this code to search the inputted data and return the matching rows:

    Please Login or Register  to view this content.

    Refer the attached file. Hope this was what you were looking for.

    Regards,
    Karan
    Attached Files Attached Files

  3. #3
    Forum Contributor
    Join Date
    02-20-2009
    Location
    bristol
    MS-Off Ver
    Excel 2003
    Posts
    882

    Re: Find the rows in excelsheet and pop up listbox with those rows

    Hi Karan

    Thanks for your reply. Actually when I try entering First name then it gives me a list matching the First name but suppose the user types both first name and surname in corresponding textboxes and press search then in this case it gives me the list that matches Firstname only.Now the user can type more than one values in different textboxes to find exact match ,in that case the code doesn't work.
    Can you please have a look again?

    Thanks
    Aman

  4. #4
    Forum Contributor
    Join Date
    04-18-2009
    Location
    Mumbai, India
    MS-Off Ver
    Excel 2016
    Posts
    269

    Re: Find the rows in excelsheet and pop up listbox with those rows

    Sorry. I did not know that you needed an 'AND' operation between the input criteria.

    Here is the new code for CommandButton1:

    Please Login or Register  to view this content.

    Please find the attached file.

    Let me know if you need anything else.

    Regards,
    Karan
    Attached Files Attached Files

  5. #5
    Forum Contributor
    Join Date
    02-20-2009
    Location
    bristol
    MS-Off Ver
    Excel 2003
    Posts
    882

    Re: Find the rows in excelsheet and pop up listbox with those rows

    Hi Karan

    Thanks for your reply. When i press search then it displays records in the listbox but column headings do not appear in the listbox.
    Could you please check it again.

    Thanks
    Aman

  6. #6
    Forum Contributor
    Join Date
    04-18-2009
    Location
    Mumbai, India
    MS-Off Ver
    Excel 2016
    Posts
    269

    Re: Find the rows in excelsheet and pop up listbox with those rows

    Hi Aman,

    I don't think we can add column headers to a list box when we want a customized output. It can be done when the list box is bound to some data. But, I am really not sure about this. Somebody else might be able to help you on this.

    So, the best you can do here is have header in the first row of the list box & start populating the results from the second row. That's what I have done in the attached file. Check it out!!

    Let me know your comments.

    Regards,
    Karan
    Attached Files Attached Files

  7. #7
    Forum Expert mikerickson's Avatar
    Join Date
    03-30-2007
    Location
    Davis CA
    MS-Off Ver
    Excel 2011
    Posts
    6,229

    Re: Find the rows in excelsheet and pop up listbox with those rows

    Doesn't AutoFilter do what you want?
    _
    ...How to Cross-post politely...
    ..Wrap code by selecting the code and clicking the # or read this. Thank you.

  8. #8
    Forum Contributor
    Join Date
    02-20-2009
    Location
    bristol
    MS-Off Ver
    Excel 2003
    Posts
    882

    Re: Find the rows in excelsheet and pop up listbox with those rows

    Hi karan

    sorry 4 replying late. when i try to open the attachment then it gives Page Blocked message as i don't have permission to open attached file in the office. can you please send me the code to have listbox headers .

    Thanks 4 your help.
    Aman

  9. #9
    Forum Contributor
    Join Date
    04-18-2009
    Location
    Mumbai, India
    MS-Off Ver
    Excel 2016
    Posts
    269

    Re: Find the rows in excelsheet and pop up listbox with those rows

    Here it is:

    Please Login or Register  to view this content.

    Regards,
    Karan

  10. #10
    Forum Contributor
    Join Date
    02-20-2009
    Location
    bristol
    MS-Off Ver
    Excel 2003
    Posts
    882

    Re: Find the rows in excelsheet and pop up listbox with those rows

    Hi Karan

    The listbox is now displaying column headers but its not displaying postcode column and data in this column. And also Is it possible to sort data in the listbox according to Forenames? Please see the code below and suggest me the changes I should make.

    Please Login or Register  to view this content.
    Thanks a lot for your help.
    Aman

  11. #11
    Forum Contributor
    Join Date
    02-20-2009
    Location
    bristol
    MS-Off Ver
    Excel 2003
    Posts
    882

    Re: Find the rows in excelsheet and pop up listbox with those rows

    Hi karan

    can you please help me in this.

    Thanks

+ 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