Results 1 to 6 of 6

Thread: excel combo box opening userform ?????

  1. #1

    Thread Starter
    New Member
    Join Date
    Jul 2005
    Posts
    10

    excel combo box opening userform ?????

    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.

  2. #2
    Lively Member JustinLabenne's Avatar
    Join Date
    Jul 2005
    Location
    Ohio
    Posts
    64

    Re: excel combo box opening userform ?????

    Assuming your combobox is from the control toolbox:
    VB Code:
    1. Option Explicit
    2.  
    3. Private Sub ComboBox1_Change()
    4.  
    5.     Select Case ComboBox1.Value
    6.    
    7.         Case "MyForm"
    8.             UserForm1.Show
    9.            
    10.         Case "YourForm"
    11.             UserForm2.Show
    12.            
    13.         Case "ThisForm"
    14.             UserForm3.Show
    15.            
    16.     End Select
    17.    
    18. End Sub
    Attached Files Attached Files
    Justin Labenne
    www.jlxl.net

  3. #3

    Thread Starter
    New Member
    Join Date
    Jul 2005
    Posts
    10

    Re: excel combo box opening userform ?????

    thanks very much justin but the combobox isnt from the control toolbox, its a different type of combobox
    Last edited by boylynch; Jul 28th, 2005 at 03:47 AM.

  4. #4

    Thread Starter
    New Member
    Join Date
    Jul 2005
    Posts
    10

    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.

  5. #5
    Lively Member JustinLabenne's Avatar
    Join Date
    Jul 2005
    Location
    Ohio
    Posts
    64

    Re: excel combo box opening userform ?????

    If it's validation

    VB Code:
    1. Option Explicit
    2.  
    3. Private Sub Worksheet_Change(ByVal Target As Range)
    4.     If Target.Address <> Range("C1").Address Then Exit Sub
    5.  
    6.     Select Case Target.Value
    7.         Case "Userform1"
    8.             UserForm1.Show
    9.         Case "Userform2"
    10.             UserForm2.Show
    11.         Case "Userform3"
    12.             UserForm3.Show
    13.     End Select
    14. End Sub
    Attached Files Attached Files
    Justin Labenne
    www.jlxl.net

  6. #6

    Thread Starter
    New Member
    Join Date
    Jul 2005
    Posts
    10

    Re: excel combo box opening userform ?????

    I think that could be it, ill work on it and reply in the meantime.

Posting Permissions

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



Click Here to Expand Forum to Full Width