Fill drop down list with all occurrences matching user input

  • Hi,

    I have a input box in a userform.

    What I want to do is look in my main database and list every occurance of the code the user puts in the userform in the dropdown box.

    For example, if my database says:

    051510010 002548565 TOP
    001017901 048152154 PLINTH
    051510010 063251454 BOTTOM

    and the user types in '051510010', the dropdown box will list

    051510010 002548565 TOP
    051510010 063251454 BOTTOM

    Any help would be greatly appreciated, as would any other methods around this?

  • Re: Fill drop down list with all occurrences matching user input


    Please note the following regarding thread titles:

    Thread titles are used in searching the forum, therefore, it is vital they be written to accurately describe your [COLOR="blue"]thread content or overall objective[/COLOR] using ONLY search friendly key words. That is, your title use as search terms would return relevant results.

    • The title must not use non-essential words such as:"Help needed", "Formula problem", "Please help", "urgent", "Code issue", "Need Advice", etc. Such words dilute the title/search results.
    • The title should not contain VBA code or formula syntax or use abbreviations, jargon, delimiters (e.g. slashes, commas, colons, etc)
    • The title should not assume or anticipate a solution as in referencing Excel functions or VBA methods - the actual solution is often quite different

    Your title of "[COLOR="red"]Populate dropdown[/COLOR]" does not describe your thread or objective and is not helpful to those searching the forum for a solution to a similar need.

    [COLOR="darkred"]Please note the change to your title, which is based on the objective stated in your thread.[/COLOR]

    If the new title still does not accurately describe your thread you may make further edits as needed per the above guidelines.

  • Re: Fill drop down list with all occurrences matching user input


    Based on the information you have provided, this is yet another use for the FindAll function:

    Using that and a bit of code, you can populate a ListBox in a Userform by pasting the results of the FindAll call into an array.

    A demo of using this method is provided in the attached sample. Of course, there is no real validation and the results are just displayed in a ListBox but this should get you started.

Participate now!

Don’t have an account yet? Register yourself now and be a part of our community!