+ Reply to Thread
Results 1 to 5 of 5

Advice needed on how best to approach building a "part number finder" UserForm

  1. #1
    Forum Contributor
    Join Date
    10-01-2018
    Location
    Virginia Beach, VA
    MS-Off Ver
    365
    Posts
    129

    Advice needed on how best to approach building a "part number finder" UserForm

    Greetings, VBA UserForm gurus!

    I have been tasked with creating a tool with which my users can easily narrow down a list of materials to find a unique part number based on somewhat random criteria, and I need to determine the best way to go about that task.

    In the "dummy file" attached, I have included a "work in progress" version of the part number list on the sheet called "Inventory" (once complete, any remaining blank cells in columns C-N can be filled with "N/A" or an equivalent placeholder, if necessary, as not all material types will have relevant data for all columns), and a second sheet (Sheet1) with simply a command button that opens the skeleton version of the userform I've laid out (no coding has been written for the userform yet, it's merely a design template presently).

    What I envision with the form is for the dropdown menus on the comboboxes (each labeled to match a column heading on the parts list, columns C-N on the "Inventory" sheet) to be dynamically filled with all unique values from the corresponding column, and input values restricted to only allow selection of an item on the dropdown list so that a value not currently visible on the Inventory sheet cannot be entered.

    When the form is initially opened (or the "clear filters" button clicked), each combobox should be completely empty as seen, and the "Material Description" listbox should be pre-populated with the full list of values in the "Material Description" column, column "B". The user would then begin by selecting an option from the dropdown list in any or all of the comboboxes, in any order. As a selection is made in each combobox, the related column on the "Inventory" sheet would be filtered to show only the selected value, and the dropdown list options in each of the remaining empty comboboxes would be updated based on the resulting visible rows after the filter from the previous combobox has been applied. As each combobox filters a column on the Inventory worksheet, the listbox would be updated to show only the descriptions from rows still visible after the selected filter(s) are applied, so with each added filter the list in the listbox would get shorter, until enough filters have been applied to narrow the list down to a single part number. Selecting a description from the list in the listbox should display the related part number in the textbox to the right (assuming that listboxes work that way... I haven't worked with a listbox before, so I am only speculating as to how they function). Clicking the "Clear Filters" button should, obviously, clear all filters and return the form to its' original state with blank boxes and a full list of materials in the listbox. Once I have the form working as intended, I will also add a "Clear" button below each individual combobox to remove only that filter and refresh the remaining fields accordingly, but I can manage that once the rest of the coding is in place for the current layout.

    I have previously worked with populating a combobox dynamically with a list of unique values from a given column on another sheet, and based on that experience I am expecting to have to create a separate hidden sheet for each combobox on which the list of unique values for each dropdown will be created... but aside from that I have no idea where to start on coding this userform to function as intended. I have written code before to fill a textbox based on a combobox selection, and also conditionally configuring a dropdown menu in one combobox based on the selection made in another combobox... but in this case I need each combobox acting independently from the rest, while at the same time having their dropdown lists recreated dynamically each time a selection is made in (or cleared from) another combobox. It's ambitious, but it seems like it should all be doable within the Excel VBA UserForm structure.

    I understand there are a number of implied questions here, and I am fine with starting a new thread for each if necessary as I embark on this task, but currently I'm not even sure that my rough plan is the best way to go about what I'm trying to do. As it stands, these are the questions I currently need answers to, or at least guidance on:


    1.) ComboBoxes:
    a.) Is it possible for each combobox to be used independently to add a filter to a column, and simultaneously trigger all remaining blank/empty comboboxes to clear and rebuild their dropdown lists based on the resulting filtered sheet, while leaving any non-blank comboboxes (and their relative filters on the sheet) alone?
    b.) Assuming the answer to question 1a is "yes", is it also possible for the "clear filters" control button to simultaneously remove all applied filters from the Inventory sheet, clear all comboboxes, and refresh all of their their dropdown lists based on the now unfiltered Inventory sheet?

    2.) ListBoxes:
    a.) Am I correct in assuming that a listbox can be conditionally populated by the values in a given column on a worksheet, and refreshed in real time as filters are added to said column by the above mentioned comboboxes, narrowing down the resulting list in the listbox?
    b.) Assuming the answer to question 2a is "yes", am I also correct in assuming that a listbox can be set up to allow a user to select only a single line from the list, and that a textbox can be populated with the value from a cell in the same row, different column based on that selection?

    3.) General:
    a.) Assuming the answer to all four above questions is "yes", is my plan the best way to achieve what I'm trying to do, or is there a simpler, more efficient way to accomplish this task?
    b.) That's pretty much it in a nut shell, but I'm a little bit O.C.D., and couldn't have a "3.)" without an "a.)", or an "a.)" without a "b.)".



    Any and all thoughts, suggestions, or examples of similar projects would be greatly appreciated... please let me know if I haven't explained anything clear enough or if I left anything important out.


    Thanks in advance!
    Attached Files Attached Files

  2. #2
    Forum Guru
    Join Date
    07-25-2011
    Location
    Florida
    MS-Off Ver
    Excel 2003
    Posts
    9,643

    Re: Advice needed on how best to approach building a "part number finder" UserForm

    1.) and 2.) are all Yeses. There are dozens of videos and guides that show how to do this. Search for something like...
    Excel UserForm multiple criteria filter

    3a.) It seems like you're describing what the Autofilter Dropdowns already do. So why go through the trouble to have a UserForm mimic the already existing capability of AutoFilter? About the only thing missing on the Worksheet is a Clear Filters button, which could be easily added.
    Surround your VBA code with CODE tags e.g.;
    [CODE]your VBA code here[/CODE]
    The # button in the forum editor will apply CODE tags around your selected text.

  3. #3
    Forum Contributor
    Join Date
    10-01-2018
    Location
    Virginia Beach, VA
    MS-Off Ver
    365
    Posts
    129

    Re: Advice needed on how best to approach building a "part number finder" UserForm

    Thanks AlphaFrog, I'll start with a search for your suggested phrase... I just wasn't sure how to trim the concept down into a search term, but that sounds like a good shot.

    As for why I want to do it through a userform, the backend of my build that I didn't mention is that the master part list needs to be completely locked down and password protected so nobody can change, move, or delete anything from the list, accidentally or otherwise. I also have to assume that at least a portion of the users have zero Excel knowledge, and are intimidated by anything resembling a spreadsheet. My plan is to design the user end of this tool to open as if the userform IS the whole program, and they will never even see the spreadsheet feeding it. I took a similar approach with converting our CNC cutting department from a paper cut log system to a digital format with great results, so this build will be a standalone extension of that system to make it easier to find the part numbers they need for entering material into the digital log... I also plan to roll it out via the company-wide network for use in other departments as well, so the interface needs to be both user-friendly and idiot-proof, not to mention "pretty", LOL!

    Thanks again for the reply!

  4. #4
    Forum Guru
    Join Date
    07-25-2011
    Location
    Florida
    MS-Off Ver
    Excel 2003
    Posts
    9,643

    Re: Advice needed on how best to approach building a "part number finder" UserForm

    I understand, but know this; you can't out-program stupid.

  5. #5
    Forum Contributor
    Join Date
    10-01-2018
    Location
    Virginia Beach, VA
    MS-Off Ver
    365
    Posts
    129

    Re: Advice needed on how best to approach building a "part number finder" UserForm

    Quote Originally Posted by AlphaFrog View Post
    I understand, but know this; you can't out-program stupid.
    I kind of want to quote this as my signature, lol...


    Let's put it this way: I'm leading the horse to the water... however, the horse may not even realize it's thirsty, and I'm not really willing or able to dunk it's head under to try and make it drink anyway. My boss wants the horse standing by the pond at all times though, just in case it gets thirsty, and it's been made my task to ensure that the horse gets to the pond without having the ability to throw the rider and run off the path, trampling all the surrounding fences, shrubbery, and/or small woodland creatures in the process. Oh, and I'm fresh out of duct tape.

+ 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. Excel "BeforeDoubleClick" coding advice needed
    By kayakfisher1 in forum Excel Programming / VBA / Macros
    Replies: 9
    Last Post: 11-03-2017, 02:16 AM
  2. Replies: 2
    Last Post: 06-30-2017, 10:10 AM
  3. [SOLVED] Stock advisory based on four variables; Urgent, Advice, Not needed and "-"
    By Excell_Ensie in forum Excel Formulas & Functions
    Replies: 3
    Last Post: 06-16-2017, 10:12 AM
  4. [SOLVED] if formula needed to populate either "1" or "0" based on number of units in another cell
    By excelteam777 in forum Excel Formulas & Functions
    Replies: 3
    Last Post: 06-07-2015, 11:24 AM
  5. [SOLVED] VBA help needed to remove all "/" then replace with "-" from cell "B3"and "B5"
    By krjoshi in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 03-17-2014, 02:11 PM
  6. [SOLVED] Formula needed to display "Pass" or "Fail" if a column contains any values other than "yes
    By andreindy in forum Excel Formulas & Functions
    Replies: 6
    Last Post: 03-26-2013, 05:49 PM
  7. Advice needed: "Portable" macros?
    By durex in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 10-06-2005, 07:05 PM

Tags for this Thread

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