+ Reply to Thread
Results 1 to 19 of 19

In need of help with Excel VBA userform with 3 combo boxes and a commandbutton

  1. #1
    Registered User
    Join Date
    02-03-2019
    Location
    Huntington Beach Ca
    MS-Off Ver
    2016
    Posts
    11

    In need of help with Excel VBA userform with 3 combo boxes and a commandbutton

    Hi Everyone, I'm new to here and also new to VBA with Excel



    here is the scenario

    I have a spreadsheet, apologies, still learning the verbiage. I mean, I have a workbook that has four worksheets.
    the One worksheet called Search is used to house the button i created called cmd_HarmListA to open the Userform titled UF1_HarmForm
    That works as expected

    What I can't figure out is how to write the code to get the Harm list to display in the first combo box so that when the Harm is selected it displays the possible matching harms from CHL and FMEA

    I need to have three combo boxes one that lists the Harms and two Combo boxes that pulls the Harms from the CHL and FMEA worksheets both using column A
    I created a button to execute called cmd_HarmList Result

    I've created all these but not fully grasping the code required
    Can someone please help me with how this works, I spent over 20 hours going through some VBA courses on udemy but
    not grasping what Im missing?
    ve tried several code but removed them because I couldn't get them to function
    everything is in place except the code to make this work.

    Where I get hung up is the data doesnt' display in the comboboxes. Is there a way to get that to pull from the columns or do I need to use the .Addto function but that would be a lot of entries and if thats the case whats the point of having the data in columns.
    Last edited by RAR1313; 02-03-2019 at 03:39 PM. Reason: terminology

  2. #2
    Forum Expert mrice's Avatar
    Join Date
    06-22-2004
    Location
    Surrey, England
    MS-Off Ver
    Excel 2013
    Posts
    4,967

    Re: In need of help with Excel VBA userform with 3 combo boxes and a commandbutton

    Consider using the AddItem method of your list object as part of a UserForm_Initialize subroutine
    Martin

  3. #3
    Registered User
    Join Date
    02-03-2019
    Location
    Huntington Beach Ca
    MS-Off Ver
    2016
    Posts
    11

    Re: In need of help with Excel VBA userform with 3 combo boxes and a commandbutton

    Thanks mrice, Ive just researched everything you mentioned. Im new to VBA and I don't fully grasp yet how all this comes together but i really appreciate the time. Thank you

  4. #4
    Forum Expert mrice's Avatar
    Join Date
    06-22-2004
    Location
    Surrey, England
    MS-Off Ver
    Excel 2013
    Posts
    4,967

    Re: In need of help with Excel VBA userform with 3 combo boxes and a commandbutton

    This is the sort of thing that I meant

    Please Login or Register  to view this content.

  5. #5
    Registered User
    Join Date
    02-03-2019
    Location
    Huntington Beach Ca
    MS-Off Ver
    2016
    Posts
    11

    Re: In need of help with Excel VBA userform with 3 combo boxes and a commandbutton

    Awesome and thank you again the car battery is acting up but will try this when i get back quick. Appreciate your thoughtfulness

  6. #6
    Registered User
    Join Date
    02-03-2019
    Location
    Huntington Beach Ca
    MS-Off Ver
    2016
    Posts
    11

    Re: In need of help with Excel VBA userform with 3 combo boxes and a commandbutton

    mrice that is exactly what I was looking for, do you know of any good videos or links that explain this? Wasn't able to find anyting like this i was attempting some crazyness like this cause that's the a solution i saw on the training video but then they went on to say that it isn't good for large amounts of data and I'm like great so now what, i started this on Friday, I've wrecked more copies of this workbook than I care to count and have had to rebuild this thing multiple times either because the code i inputted crashed and burned that amazing thing or Im just an enduser learning. Thank you again for the time.


    Please Login or Register  to view this content.

  7. #7
    Registered User
    Join Date
    02-03-2019
    Location
    Huntington Beach Ca
    MS-Off Ver
    2016
    Posts
    11

    Re: In need of help with Excel VBA userform with 3 combo boxes and a commandbutton

    Ok, so ive invested another few hours in trying to figure out how to get this code to work.

    Maybe I have it backwards. Im not exactly sure what I'm doing with this code
    but what Im attempting to achieve is when the first combo box "Named" cbo1_HarmList and the data selected
    in combo box cbo2_CHL the data from Worksheet CHL column A that matches the data selected in Combo box cbo1_HarmList
    I attached a pic with notes of what is supposed to happen. ")

    Basically if Back Pain was selected in the first Combo Box then in the CHL combo box anything in the worksheet CHL column A would populate into that combo box.

    Oddly when I run this i don't get an error but nothing happens either. Probably something simple that I over looked or over analyzed.
    Sometimes my brain runs right while my eyes go left with this stuff.

    Im so close to the end of my journey and to be honest Ive
    become infatuated with makiing this a success. I appreciate the input and help thank you! ComboBox.png

    Please Login or Register  to view this content.

  8. #8
    Valued Forum Contributor
    Join Date
    02-02-2016
    Location
    Indonesia
    MS-Off Ver
    Office 365
    Posts
    995

    Re: In need of help with Excel VBA userform with 3 combo boxes and a commandbutton

    Can you attach a sample workbook.

    To attach a file:
    In the reply box, scroll down and press Go Advanced button and then scroll down and press Manage Attachments.
    Upload your file then click "Close this window"

  9. #9
    Registered User
    Join Date
    02-03-2019
    Location
    Huntington Beach Ca
    MS-Off Ver
    2016
    Posts
    11

    Re: In need of help with Excel VBA userform with 3 combo boxes and a commandbutton

    Hi Akuini Hope your doing awesome

    Please find attached the document.

  10. #10
    Valued Forum Contributor
    Join Date
    02-02-2016
    Location
    Indonesia
    MS-Off Ver
    Office 365
    Posts
    995

    Re: In need of help with Excel VBA userform with 3 combo boxes and a commandbutton

    I don't quite understand what you're trying to do.
    Say you select "Anxiety" in Harmlist combobox, do you want CHL combobox show the list of cell value (in CHL sheet) that contains word "Anxiety" in it? And also for FMEA combobox (with sheet FMEA)?

    How big is your actual data? How many rows of data in each sheets?

    Your sample data has many duplicates, what about your actual data?

  11. #11
    Registered User
    Join Date
    02-03-2019
    Location
    Huntington Beach Ca
    MS-Off Ver
    2016
    Posts
    11

    Re: In need of help with Excel VBA userform with 3 combo boxes and a commandbutton

    Cool so let me explain. The duplicates need to stay and heres why, The entries in the CHL and FMEA have multiple scenarios that require the same Harm associated as this is only a small piece of the puzzle. The Harms list doesn't have duplicates because its only to select from and then the FMEA and CHL will display their contents, so lets say for example you chose Bruising from the Harms List then in the CHL and FMEA they would have numerous Bruising scenarios and when we add the other pieces on which i dont have yet it will show why there are so many different variations of brusing. Does that make sense... Basically the options in the Harm List when selecting one will display all the available listings in the FMEA and CHL and the reason for this is they all have to be accounted for or something like that.

  12. #12
    Valued Forum Contributor
    Join Date
    02-02-2016
    Location
    Indonesia
    MS-Off Ver
    Office 365
    Posts
    995

    Re: In need of help with Excel VBA userform with 3 combo boxes and a commandbutton

    I don't understand "they would have numerous Bruising scenarios"
    Well, I need to be clear:
    Say you select "bruise" in Harmlist combobox, do you want CHL combobox show the list of cell value (in CHL sheet) that contains word "bruise" in it? And also for FMEA combobox (with sheet FMEA)?

    So do you want all the duplicate - if any - shows up in the list not just the the unique value?

  13. #13
    Registered User
    Join Date
    02-03-2019
    Location
    Huntington Beach Ca
    MS-Off Ver
    2016
    Posts
    11

    Re: In need of help with Excel VBA userform with 3 combo boxes and a commandbutton

    That is exactly correct, I agree it doesn't make much sense but "they" say it will
    and Im like a newb :0 I really appreciate you taking the time to help me with this, grateful.

  14. #14
    Valued Forum Contributor
    Join Date
    02-02-2016
    Location
    Indonesia
    MS-Off Ver
    Office 365
    Posts
    995

    Re: In need of help with Excel VBA userform with 3 combo boxes and a commandbutton

    Quote Originally Posted by RAR1313 View Post
    That is exactly correct, I agree it doesn't make much sense but "they" say it will
    and Im like a newb :0 I really appreciate you taking the time to help me with this, grateful.
    I asked you 2 question, which one did you reply by "correct"? both of them?

  15. #15
    Registered User
    Join Date
    02-03-2019
    Location
    Huntington Beach Ca
    MS-Off Ver
    2016
    Posts
    11

    Re: In need of help with Excel VBA userform with 3 combo boxes and a commandbutton

    Say you select "bruise" in Harmlist combobox, do you want CHL combobox show the list of cell value (in CHL sheet) that contains word "bruise" in it? And also for FMEA combobox (with sheet FMEA)? Yes

    So do you want all the duplicate - if any - shows up in the list not just the the unique value? Yes

  16. #16
    Valued Forum Contributor
    Join Date
    02-02-2016
    Location
    Indonesia
    MS-Off Ver
    Office 365
    Posts
    995

    Re: In need of help with Excel VBA userform with 3 combo boxes and a commandbutton

    OK, here's what I got so far.

    Note:
    I don't know what will you do after you select an item in those 3 combobox, so the code is just to show the list using the criteria above.

    Please Login or Register  to view this content.
    Thing to consider:
    If your actual data is big and many items has so many words in it then you may want to consider using a listbox & a textbox that can searh as you type.
    Here's an example, let me know if you're interested with this method.

  17. #17
    Registered User
    Join Date
    02-03-2019
    Location
    Huntington Beach Ca
    MS-Off Ver
    2016
    Posts
    11

    Re: In need of help with Excel VBA userform with 3 combo boxes and a commandbutton

    Thank you seriously Im anxious to work with this. I'll try both methods I was curious about the data feed and amount and what impact that could have
    on performance. Etc. Sweet back to work love it.

  18. #18
    Registered User
    Join Date
    02-03-2019
    Location
    Huntington Beach Ca
    MS-Off Ver
    2016
    Posts
    11

    Re: In need of help with Excel VBA userform with 3 combo boxes and a commandbutton

    That's really clean list box, I don't know if that would work for this as the requirment is to match data so to speak. you could say i guess its a data validation tool to verify that data A matches Data B kinda what we're doing, Im still learning the programming verbiage so apologies if Its hard understand what Im trying to accomplish . Is there a way to make a text box list like that that would still reference the data I think we would still need the combo box for that reference point and then two list boxes that would display the results. Im going to see and play with it a bit

  19. #19
    Valued Forum Contributor
    Join Date
    02-02-2016
    Location
    Indonesia
    MS-Off Ver
    Office 365
    Posts
    995

    Re: In need of help with Excel VBA userform with 3 combo boxes and a commandbutton

    Well, my example only use 1 list box & 1 textbox just to show you how the search process is done.
    For your data set up we still need 3 listbox in the userform, or actually we can set up 3 combobox that can search as you type too. But this method actually depends on how big you data is.

+ 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. [SOLVED] Kindly Help Excel Vba Userform Need to Add Extra Combo Boxes
    By tariqjahangir in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 10-06-2016, 12:41 AM
  2. [SOLVED] Clear all text boxes-combo boxes in a userform.
    By MariaPap in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 01-31-2014, 11:16 AM
  3. [SOLVED] Help with code for userform text boxes, combo boxes and excel
    By innerise in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 01-20-2014, 09:07 AM
  4. 3-tiered dependent combo boxes in userform using excel 2007
    By sahas in forum Excel Programming / VBA / Macros
    Replies: 6
    Last Post: 04-20-2013, 02:39 AM
  5. Two Combo boxes on one UserForm
    By NonSira in forum Excel Programming / VBA / Macros
    Replies: 17
    Last Post: 06-23-2010, 03:06 AM
  6. Combo Boxes in UserForm
    By Chris1201 in forum Excel Programming / VBA / Macros
    Replies: 7
    Last Post: 01-14-2010, 05:11 PM
  7. Userform with 2 combo boxes
    By WhiteKelso in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 11-30-2007, 11:46 AM

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