Results 1 to 4 of 4

Thread: VBA for combobox depending on value of another

Hybrid View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Seeker Jannis's Avatar
    Join Date
    May 2020
    Posts
    16
    Articles
    0
    Excel Version
    2016

    VBA for combobox depending on value of another

    I have a spreadsheet (attached)
    it has a userform with 4 comboboxes in it Depending on the value of the first combobox (rep names [Tom, Barry, Kim]), then combobox 2, 3 and 4 will have data drop down that pertains to that name
    I have named ranges in cells A1-A6 called Tom, Cells A9 - A12 called barry, and A15-18 called kim
    Example if Tom is selected in Combobox 1 then in Comboboxes 2, 3 , and 4 only Red, Green, Yellow, Blue will appear
    if Barry is selected in combobox1 then in comboboxes 2,3 and 4 only purple, pink, brown and black will appear
    if Kim is selected in Combobox1 then in comboboxes 2,3 and 4 only white, clear, Orange and grey will appear

    I am looking for VBA to put into userform so I can place data on sheet 2 Combobox 1 into sheet 2 cell A1, Combobox2 into sheet 2 cell B1, Combobox3 into sheet2 cell C1 and combobox4 into sheet 2 cell D1

    Any help would be FANTASTIC
    Attached Files Attached Files

  2. #2
    Seeker RET's Avatar
    Join Date
    Nov 2020
    Location
    Spain
    Posts
    13
    Articles
    0
    Excel Version
    2019
    Just use the event change for Combo1 to re-populate the rest of combos depending upon selected value in combo 1. And do not forget to clear them beofre re-populate

  3. #3
    Seeker Jannis's Avatar
    Join Date
    May 2020
    Posts
    16
    Articles
    0
    Excel Version
    2016
    Could you point me to where I get some assistrance on how to incorperate this in my userform VBA please

  4. #4
    Seeker RET's Avatar
    Join Date
    Nov 2020
    Location
    Spain
    Posts
    13
    Articles
    0
    Excel Version
    2019
    Just go to your form, click the combo ComboBox4 you use for Rep Name, right click and go to see code. It will create a Sub ComboBox4_Change. Insert your code there that will be executed when that combo changes

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •