VBA excel: How to enable combobox selection

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • josef01
    New Member
    • Jul 2010
    • 2

    #1

    VBA excel: How to enable combobox selection

    I want to store data’s in selected sheet from drop down menu in userform .Suppose if I select sheet 1 data should be stored in sheet1 if I select sheet2 data’s should be stored in sheet2 . With the code below I can add sheet names in combo box. If someone helps me I shall be grateful to you.
    Code:
    Private Sub UserForm_Initialize()
    Dim i As Integer
    For i = 1 To Worksheets.Count
        Me.ComboBox1.AddItem Worksheets(i).Name
    Next i
    End Sub
    Last edited by NeoPa; Jul 19 '10, 02:18 PM. Reason: Please use the [CODE] tags provided.
  • MikeTheBike
    Recognized Expert Contributor
    • Jun 2007
    • 640

    #2
    Originally posted by josef01
    I want to store data’s in selected sheet from drop down menu in userform .Suppose if I select sheet 1 data should be stored in sheet1 if I select sheet2 data’s should be stored in sheet2 . With the code below I can add sheet names in combo box. If someone helps me I shall be grateful to you.


    Private Sub UserForm_Initia lize()
    Dim i As Integer
    For i = 1 To Worksheets.Coun t
    Me.ComboBox1.Ad dItem Worksheets(i).N ame
    Next i
    End Sub
    Hi

    That seem fine, so fare, but what is the problem?

    MTB

    Comment

    Working...