change the value in a combobox based off another combobox all within a userform.

Glitch_

New Member
Joined
Oct 15, 2014
Messages
4
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 labled as Quantity.

currently this is the code I have tried with no luck

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

I have asked this on another forum as well. Change value in a combobox based off another combobox all within a userform?
 
Last edited:

Excel Facts

How to find 2nd largest value in a column?
MAX finds the largest value. =LARGE(A:A,2) will find the second largest. =SMALL(A:A,3) will find the third smallest
Was just a a few typos in the code. Works great now.
Here is the correct code.


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
 
Upvote 0

Forum statistics

Threads
1,216,227
Messages
6,129,609
Members
449,520
Latest member
TBFrieds

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top