Userform Listbox header display

  • Dear Team,

    I had created the userform for Add, Update, Delete the customer details. And I am having listbox for display the details. When i am entering any values on Combobox2. it will search the customer name accordingly and display the details on Listbox1.

    I want to update the header for my listbox1. The header range is Sheet "Customer Data" ("A2:H2").

    My code is

    I don't know how to add this headers.

    I am attaching my file here for your reference.

    Please help me to solve this issue

  • To populate a ListBox with a Range the best way is to use the List Property not AssItem with a Loop. List will not work with HeaderRows though so us Rowsource.

    You cant do that in this ListBox because your range is not contiguous, you would need to Copy the cells to a temporary sheet, which isn't really worth the time.

  • Dear Roy,

    I modified the code with copy paste the datas to another sheet. Now the listbox header is updating

    New code is

    But only one small problem. When my combobox2 is blank the list box should not display any only. Only it should display value if I type any vales on Combobox2.

    My request is can you please check and correct the code Please

  • If you change the name of a Control then you need to change any code which references it.