How to save combobox values on userform after adding new combobox value and closing excel vba

  • Hi all,


    I'm trying to create a simple userform with combobox values then allows user to add new items and save the items( in the sense the values that you key values into the textbox and both combobox1 and combobox2 gets updated and remains after closing and opening the excel file). Here is my code:


    Private Sub ComboBox1_Change()


    End Sub

    Private Sub ComboBox2_Change()


    End Sub

    Private Sub CommandButton1_Click()

    Me.ComboBox2.AddItem Me.TextBox1.Value

    Me.ComboBox1.AddItem Me.TextBox1.Value

    Me.TextBox1.Value = ""

    MsgBox "Category added to combobox!!"

    End Sub


    Private Sub UserForm_Activate()


    Me.ComboBox1.AddItem "Chicken"


    Dim sh As Worksheet

    Dim i As Integer



    End Sub




    I will appreciate any help.

  • Hi,


    In order to have your newly added data still available after closing Excel ... you do need to store these data into a worksheet ...:)

    If you feel like saying "Thank You" for the help received, do not hesitate to click the "Thumbs Up" icon, below, in the bottom right corner:)

Participate now!

Don’t have an account yet? Register yourself now and be a part of our community!