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

Important Notice


Please note that on 14th December 2023 users will experience an expected outage whilst we make upgrades to our network. We anticipate this process may take a couple of hours and so we apologise in advance for any inconvenience.

  • 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 "Smiley" 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!