+ Reply to Thread
Results 1 to 8 of 8

Cascading ComboBoxes all inside a userform?

Hybrid View

  1. #1
    Registered User
    Join Date
    10-20-2014
    Location
    Arkansas
    MS-Off Ver
    2010
    Posts
    41

    Cascading ComboBoxes all inside a userform?

    UL.xlsm
    Is this possible?

    I have a userform with a series of Comboboxs. The idea is when you change the combobox "ztype" it changes the comboboxs "zamps", in every case but one.

    When " ztype" is Awning Lighting then amps is 1
    When " ztype" is 27in Channel Letters then zamps is 2
    When " ztype" is 36in Channel Letters then zamps is 2
    When " ztype" is Coffee Sign then zamps is 1
    When " ztype" is Light Bar then zamps is 3
    When " ztype" is Marketing Case then zamps is 2
    However, when ztype is Price Sign zamps needs to offer a list that I have labeled as Quantity.

    UL.xlsm

    currently this is the code I have tried with no luck

    If ztype.Value = "Awning Lighting" Then
                    UserForm1.zamps.Value = "1"
                     End If
             If ztype.Value = "27in Channel Letters" Then
                       UserForm1.zamps.Value = "2"
            End If
             If zcode.Value = "36in Channel Letters" Then
              UserForm1.zamps.Value = "2"
            End If
             If ztype.Value = "Coffee Sign" Then
                UserForm1.zamps.Value = "2"
            End If
             If ztype.Value = "Light Bar" Then
               UserForm1.zamps.Value = "1"
            End If
             If ztype.Value = "Marketing Case" Then
               UserForm1.zamps.Visible = False
              UserForm1.zamps.Value = "3"
            End If
             If ztype.Value = "Parallelgram" Then
              UserForm1.zamps.Value = "2"
            End If
             If ztype.Value = "Price Sign" Then
              UserForm1.zamps.Value = Quantity
            End If

    I have asked this on another forum before coming here.
    Last edited by CtrlAltDelete; 11-19-2014 at 01:11 PM. Reason: people are not seeing the Attachement adding a second link

  2. #2
    Registered User
    Join Date
    11-19-2014
    Location
    Grand Cayman
    MS-Off Ver
    2013
    Posts
    1

    Re: Change value in a combobox based off another combobox all within a userform?

    You are looking for a Cascading Combo box set which will allow you to filter data for one combobox depending on the first one. This video should help you https://www.youtube.com/watch?v=SpMyGlEInGs

  3. #3
    Registered User
    Join Date
    10-20-2014
    Location
    Arkansas
    MS-Off Ver
    2010
    Posts
    41

    Re: Change value in a combobox based off another combobox all within a userform?

    I should have clarified, I am using Excel not Access. Can this only be done in Access?

  4. #4
    Forum Guru Norie's Avatar
    Join Date
    02-02-2005
    Location
    Stirling, Scotland
    MS-Off Ver
    Microsoft Office 365
    Posts
    19,644

    Re: Cascading ComboBoxes all inside a userform?

    Can you upload an example workbook?

    Click on GO ADVANCED and use the paperclip icon to open the upload window.
    If posting code please use code tags, see here.

  5. #5
    Registered User
    Join Date
    10-20-2014
    Location
    Arkansas
    MS-Off Ver
    2010
    Posts
    41

    Re: Cascading ComboBoxes all inside a userform?

    Thanks -->UL.xlsm
    Last edited by CtrlAltDelete; 11-19-2014 at 12:50 PM.

  6. #6
    Forum Guru Norie's Avatar
    Join Date
    02-02-2005
    Location
    Stirling, Scotland
    MS-Off Ver
    Microsoft Office 365
    Posts
    19,644

    Re: Cascading ComboBoxes all inside a userform?

    Why are you referring to zcode?

    That's textbox not a combobox.

    Also, why are you hiding zamps?

  7. #7
    Registered User
    Join Date
    10-20-2014
    Location
    Arkansas
    MS-Off Ver
    2010
    Posts
    41

    Re: Cascading ComboBoxes all inside a userform?

    I fixed the code after the typo and it worked. Thank you so much Norie.

    Here is the correct code.

    Private Sub ztype_Change()
    
    If ztype.Value = "Awning Lighting" Then
                    UserForm1.zamps.Value = "1"
                     End If
             If ztype.Value = "27in Channel Letters" Then
                       UserForm1.zamps.Value = "2"
            End If
             If zcode.Value = "36in Channel Letters" Then
              UserForm1.zamps.Value = "2"
            End If
             If ztype.Value = "Coffee Sign" Then
                UserForm1.zamps.Value = "2"
            End If
             If ztype.Value = "Light Bar" Then
               UserForm1.zamps.Value = "1"
            End If
             If ztype.Value = "Marketing Case" Then
                     UserForm1.zamps.Value = "3"
            End If
                     If ztype.Value = "Price Sign" Then
                     UserForm1.zamps.Value = "Select"
            End If
            
    End Sub
    Last edited by CtrlAltDelete; 11-19-2014 at 01:12 PM.

  8. #8
    Registered User
    Join Date
    10-20-2014
    Location
    Arkansas
    MS-Off Ver
    2010
    Posts
    41

    Re: Cascading ComboBoxes all inside a userform?

    ok so the zcode should be ztype (was a typo). I was going to try to hide the zamps, because I thought if the value is already filled I don't need to enter it except with price sign. However, I really don't care if they hide or not. I have changed my code in my post to prevent any future confuion. Thanks
    Last edited by CtrlAltDelete; 11-19-2014 at 01:03 PM.

+ 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. Userform Combobox to populate form: Can I change the order of the columns in the combobox?
    By CraigWiggins in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 10-31-2014, 12:14 PM
  2. Userform Combobox to populate based on selection in another combobox
    By Excelnoub in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 01-14-2014, 03:34 PM
  3. [SOLVED] VBA Userform ComboBox: Content of ComboBox based off of Conditional Statement
    By Brianandstewie in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 05-16-2013, 03:00 PM
  4. [SOLVED] Excel Userform: Populate other controls (i.e. textbox & combobox) based on combobox select
    By MileHigh_PhD in forum Excel Programming / VBA / Macros
    Replies: 6
    Last Post: 01-22-2013, 04:50 PM
  5. [SOLVED] Add RowSource to Userform ComboBox based on value on Another ComboBox
    By Baziwan in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 10-10-2012, 01:17 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