VBA code for adding a new value in data range using user form

  • I have created a userform based on lists present in excel.


    Case 1. Combobox Cateogary , allows user to select from drop down . The drop down contains list like Fruits , Vegetables etc.
    I want to allow the user to add new values to this drop down. So if the user manually types in say Beverages
    There is a pop which says : Do you want to add this new value. If he selects yes. then that value starts showing in drop down.
    It also means that the Beverage is added to the list in row source in excel in the end of the list.


    Case 2.There is another Combobox Risk SubCateogary. If so if user selects Cateoagry= Fruits , a dependant list is shown in SubCateogary. It has dropdown like Apple,Mango etic. This is done using case rules to create a dependancy.


    Now if the user adds something new to Catoegary , say beverage , he should add something to Subcateogary.
    And this new value should get added by creating a new list, new names etc.


    Case 3. If user selects Sub-Cateogary ( Apple existing in list) , user should be allowed to add a new value in this sub catoegary say : Kiwi without affecting the dependancy


    Can someone share a code for same? I tried listindex etc but unable to make a headway.

Participate now!

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