excel combo box opening userform ?????
:confused: i have an excel sheet with a combo box containing a list of names on it. when i click on a name in the combo box i would like a specific userform to appear, this is probably a pretty basic problem but i would like to know how to write the code for this.
1 Attachment(s)
Re: excel combo box opening userform ?????
Assuming your combobox is from the control toolbox:
VB Code:
Option Explicit
Private Sub ComboBox1_Change()
Select Case ComboBox1.Value
Case "MyForm"
UserForm1.Show
Case "YourForm"
UserForm2.Show
Case "ThisForm"
UserForm3.Show
End Select
End Sub
Re: excel combo box opening userform ?????
thanks very much justin but the combobox isnt from the control toolbox, its a different type of combobox
Re: excel combo box opening userform ?????
its an excel drop down list box, i think its of the type made with data validation, not quite sure.
1 Attachment(s)
Re: excel combo box opening userform ?????
If it's validation
VB Code:
Option Explicit
Private Sub Worksheet_Change(ByVal Target As Range)
If Target.Address <> Range("C1").Address Then Exit Sub
Select Case Target.Value
Case "Userform1"
UserForm1.Show
Case "Userform2"
UserForm2.Show
Case "Userform3"
UserForm3.Show
End Select
End Sub
Re: excel combo box opening userform ?????
I think that could be it, ill work on it and reply in the meantime.