+ Reply to Thread
Results 1 to 19 of 19

search userform help please

  1. #1
    Registered User
    Join Date
    03-01-2012
    Location
    UK
    MS-Off Ver
    Excel 2010
    Posts
    33

    search userform help please

    Hi all ..

    I am trying to create a userform to return a value in a listbox using a textbox search .. The workbook has thousands of rows and i need the search to filter out as much as possible ... i also need to be able to use several * wildcards in each the search.



    I have attached a sample of what i have so far

    Thanks in advance
    Clarkey
    Attached Files Attached Files

  2. #2
    Forum Expert
    Join Date
    12-14-2012
    Location
    London England
    MS-Off Ver
    MS 365 Office Suite.
    Posts
    8,448

    Re: search userform help please

    I don't use wild cards but my search routines are quite powerful.

    type your data in cells C8 to G12 to search. one cell must have 3 characters before the macro kicks in.

    eg type in Bill, S, Her into three cells and see what happens.

    This uses a worksheet change macro in the sheet specific macro area, [ ?Right Cklick on sheet name and select view code ]

    The other macros are self evident
    Attached Files Attached Files
    Last edited by mehmetcik; 11-28-2013 at 09:42 PM.

  3. #3
    Registered User
    Join Date
    03-01-2012
    Location
    UK
    MS-Off Ver
    Excel 2010
    Posts
    33

    Re: search userform help please

    Thanks Mehmetcik
    Unfortunately your search suggestion will not work for my need ...
    I have 2 columns A:part Number B:Description
    my specific need is that My userform has a textbox for search input and a listbox to display the results..
    So..
    I want to be able to type in the search textbox parts of the description using wildcards for missing parts of the description and a selection of possibilities to my search be displayed in the listbox..

    There is several thousand parts in the full worksheet to be searched with several similar descriptions ..
    The problem with what i have is if i put in *AC* in the search i get a couple of hundred results if i then put in *AC*1/8* i can narrow the results to a hundred or so if i then search *AC*1/8*10.0* i get nearly the same number of results and returns some results without 10.0 in the description .... It seems to max out on number of wildcards i can use in my search

    Thanks Anyway

  4. #4
    Forum Expert nilem's Avatar
    Join Date
    10-22-2011
    Location
    Ufa, Russia
    MS-Off Ver
    2013
    Posts
    3,377

    Re: search userform help please

    Hi CLARKEY1,
    perhaps this example will approach for you
    Attached Files Attached Files

  5. #5
    Registered User
    Join Date
    03-01-2012
    Location
    UK
    MS-Off Ver
    Excel 2010
    Posts
    33

    Re: search userform help please

    Nilem,

    That is pretty close but i need to know the part number in column A as well in the lower text box

    Thanks

  6. #6
    Forum Expert nilem's Avatar
    Join Date
    10-22-2011
    Location
    Ufa, Russia
    MS-Off Ver
    2013
    Posts
    3,377

    Re: search userform help please

    Where is the lower text box? Can you show an example?

  7. #7
    Forum Expert millz's Avatar
    Join Date
    08-14-2013
    Location
    Singapore
    MS-Off Ver
    Excel, Access 2016
    Posts
    1,694

    Re: search userform help please

    See if this is what you wanted.
    Attached Files Attached Files

  8. #8
    Registered User
    Join Date
    03-01-2012
    Location
    UK
    MS-Off Ver
    Excel 2010
    Posts
    33

    Re: search userform help please

    Hi Millz,

    I cant get that to search anything ... unless im missing something ... I put *AC* in search and "no results found" returns

    Nilem,

    I mean listbox .. your search worked fine apart from in the listbox i need the part number and description ... not just description

  9. #9
    Forum Expert millz's Avatar
    Join Date
    08-14-2013
    Location
    Singapore
    MS-Off Ver
    Excel, Access 2016
    Posts
    1,694

    Re: search userform help please

    I thought you only wanted to look through the part numbers, lol.

    Try this amended:
    Attached Files Attached Files

  10. #10
    Registered User
    Join Date
    03-01-2012
    Location
    UK
    MS-Off Ver
    Excel 2010
    Posts
    33

    Re: search userform help please

    Millz,

    Still having same issue .... not sure if im doing it wrong ......

    what i need is ...

    i need to type my search terms in the text box, some of the characters may be wild cards(*).. this is only going to refer to description column (B) on worksheet ... hit search ... and the textbox will populate with part numbers and descriptions that match that search

  11. #11
    Forum Guru Kyle123's Avatar
    Join Date
    03-10-2010
    Location
    Leeds
    MS-Off Ver
    365 Win 11
    Posts
    7,239

    Re: search userform help please

    Building on nilem's code:
    Please Login or Register  to view this content.
    @millz, try to avoid using .AddItem when you have more than 5 items, it's extremely slow; also when searching through a range, copy it to an array first and loop through that. Looping though a range on the worksheet is also sloooow

  12. #12
    Registered User
    Join Date
    03-01-2012
    Location
    UK
    MS-Off Ver
    Excel 2010
    Posts
    33

    Re: search userform help please

    Kyle .....

    Yay .... That seems to do the trick .... Thanks

  13. #13
    Registered User
    Join Date
    03-01-2012
    Location
    UK
    MS-Off Ver
    Excel 2010
    Posts
    33

    Re: search userform help please

    After a little people testing we came to the conclusion that Nilem's code and system worked well but took too long to load and search as there is over 40,000 parts in the full catalogue .. So went back to my original search userform ... which works sort of ok and usable ... then it was suggested that we should be able to search in the oposite way ... ie. search for a part number including wildcards (*) in textbox2 that will populate listbox2 with the completed part number and description ... I have completed the userform to reflect this change but can't get the partnumber search to work ...
    I have attached what i have so far and any help would be much appreciated
    please be aware this attachement is only a small part of the complete list of parts that has over 40,000 rows

    Many Thanks
    Attached Files Attached Files

  14. #14
    Forum Guru Kyle123's Avatar
    Join Date
    03-10-2010
    Location
    Leeds
    MS-Off Ver
    365 Win 11
    Posts
    7,239

    Re: search userform help please

    Don't you have a database? Excel is for adding things up...

  15. #15
    Forum Expert nilem's Avatar
    Join Date
    10-22-2011
    Location
    Ufa, Russia
    MS-Off Ver
    2013
    Posts
    3,377

    Re: search userform help please

    Hi CLARKEY1,
    try it (with using Kyle's code)
    Please Login or Register  to view this content.

  16. #16
    Valued Forum Contributor
    Join Date
    03-22-2013
    Location
    Australia,NSW, Wirrimbi
    MS-Off Ver
    Excel 2013
    Posts
    1,057

    Re: search userform help please

    Hi..

    I have gone for a different approach that i used for something similar (finding keywords) before..

    Just type 3 search criteria in the yellow cells and press the "Search" button..

    The results with be sorted to show the ones with more of your 'criteria' in them.. also.. the criteria that is found in each result is bolded and different color so it stands out..

    The advantage of using this kind of search is you don't have to care about the specific order that a criteria is in the parts descriptions..

    Also note.. you don't have to always enter 3 Criteria.. and the less criteria entered... the faster it is..
    Attached Files Attached Files
    Last edited by apo; 11-30-2013 at 02:57 AM.

  17. #17
    Valued Forum Contributor john55's Avatar
    Join Date
    10-23-2010
    Location
    Europe
    MS-Off Ver
    Excel for Microsoft 365
    Posts
    2,060

    Re: search userform help please

    or this one, just type in the green box the 1st letter/number and in the listbox you can see the results, the more typing the narrow result you have. this is a code used in one of my file and ...just see if it helps you.
    Attached Files Attached Files
    Regards, John55
    If you have issues with Code I've provided, I appreciate your feedback.
    In the event Code provided resolves your issue, please mark your Thread as SOLVED.
    If you're satisfied by any members response to your issue please use the star icon at the lower left of their post.

    ...enjoy -funny parrots-

  18. #18
    Registered User
    Join Date
    03-01-2012
    Location
    UK
    MS-Off Ver
    Excel 2010
    Posts
    33

    Re: search userform help please

    Thanks All,

    This now works exactly how i need it to ....... 1 question though .. why do some of the descriptions populate the text box correctly and some dont have a space between part number and description ..... if anyone would like to try .. search for W109* in part number search and view the results, (This happens in both part number search and description search) ..... this is a minor issue and not something i can't live with ... would just be nice to tidy up .... Apart from that ..... Thanks to all who have helped ........

    I have attached a very small sample to view
    Attached Files Attached Files

  19. #19
    Registered User
    Join Date
    03-01-2012
    Location
    UK
    MS-Off Ver
    Excel 2010
    Posts
    33

    Re: search userform help please

    DOH .... Changed the font and it all worked ...... SOLVED .... Thanks All

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

Similar Threads

  1. Replies: 2
    Last Post: 09-13-2013, 11:02 AM
  2. Search UserForm ...
    By z-eighty2 in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 07-12-2013, 09:31 AM
  3. Userform Search Function Autofilter Results and Repopulate Userform
    By cindy71 in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 08-16-2012, 03:46 PM
  4. UserForm to search sheet, show results on separate userform?
    By egemenkepekci in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 05-25-2010, 01:06 PM
  5. Search Userform
    By sukyb1 in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 03-27-2009, 02:00 PM

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