Userform Listbox column heading

  • Hi Experts,

    I am not able get this problem straight out and need your help here; So I have a "sheet2" that has data with the header. I wanted to create header grid so the viewer can distinguish between header and data. Can we do that by making the code change or listbox properties to show header in grid format???

    for reference, the code which reads the sheet

    in this case, A1 to K1 are my headers and data starts from row A2 to K2. I want A1:K1 to show in header grid on listbox and rest data to be shown below...

    thanks in advance!

  • Re: Userform Listbox column heading distingusih between data and header

    Please read the Forum Rules and use Code Tags in future.

    The List Property does not work with Headers.

    You do not need to create an array from the data.

    Try this

  • Re: Userform Listbox column heading distinguish between data and header

    Hi royUK, Thanks for responding to the post and the guided towards the Forum Rules. As I am new and still learning the rules and excel, I am sure will get used to it following the rules.

    Pardon me that I didn't explained well at my previous post or should have attached the sample file for the full context. So the list box has data that is search based on the textbox (searching for the correct name based on column B and C). I am not sure how and where to make changes in the code so the full functionality works properly. The goal here is not to show the headers in the listbox (which I am sure you have provided the solution in the previous response but not sure how the other code need to be changed) Therefore, attaching the file for your review and suggested changes in the other code. Please help here! thanks

  • Re: Userform Listbox column heading distinguish between data and header

    It's still not clear what you want.

    You have the ListBox populated and a TextBox to enter a search term in. What happens next? It seems like you might be wanting to populate UserForm2 with the data. If you are then
    1. You don't need to search, simply use the selected item in the ListBox
    2. Why have two userforms?

  • Re: Userform Listbox column heading distinguish between data and header

    Thanks roy. The reason i have userform2 beacuse there is a column that description are too long to show in listbox therefore, i select item and shows details on userform2. Based on your help woth code, to not to show column headers in the userform1 listbox for data...i was not able to make changes in the code thats why sent you the whole code to make necessary changes so the userform1 listbox data dont show column header and only show data. Rest everything looks good on the listbox3 xls. I hope it makes sense. Pls ket me know thsnks

  • Re: Userform Listbox column heading distinguish between data and header

    You don't need a second UserForm. The example that I posted can do what you want with your data.

    You do not want to use the TextBox Change event, use the Exit event.

    I've already posted how to load the ListBox more efficiently.

    Anyway, I think this is what you want

  • Re: Userform Listbox column heading distinguish between data and header

    Hi Ray, liked your design very much to have all the info on same userform. The only thing is that my listbox row items are going to be in 1000 of rows. Having said that, I need a search function so the I could search for items row e.g. search by full name and Alias name "John Cona" and "jc"the listbox should only show all the matching "johns" as I type and once I type C for cona at that I should be able to see only John Cona and then I click it to open it in the text boxes to show the relevant data. Can you modify your provided sample code the way I have in sample listbx3 (already attached) file to search data??? That will be so kool???Many thanks

  • Re: Userform Listbox column heading distinguish between data and header

    Hello Roy, I tried the last example that you provided and it is searching based on full record...but I wanted it to be e.g. in the attached listbox3, there are 3 records by the first name John, so as I type in the search box "John" the listbox should only show records by the name John in this case John Cona, John Ring and John Kellem. But as soon as I type John K then list should show only John Kellem and all other john should vanish from the list and I should only have option with John Kellem to select. Similarly, if in my search box I have John K and if I backspace/remove K then I should see all the options with all the Johns. This search should be based on column B and C. I think its called partial search and that's what my design is...Can you help me add the functionality in your code to do so based on my example??

    I tried with your last example and in this what is happening is e.g. when I type John Kellem and hit shows two records in the list, first is John Cona and second is John Kellem ( this is the case with any I search the first one always shows John Cona in the list I think because that's the first row on my worksheet and is considered as header maybe) and if I backspace my search it does not give me my search back and I have to exit the form to reload where I should get my list back if there is no text in textbox to search.

    many thanks for your time and expertize here to make it workable code... cheers.

  • Re: Userform Listbox column heading

    Your code only allows one search, you cannot backspace. This is because the code removes items from the ListBox

  • Re: Userform Listbox column heading


    My situation is a bit different. I have a userform with textboxes and combo boxes that populate a listbox. Then a save button essentially captures that information on to a designated excel sheet.

    Here is my issue:
    If a user opens the userform and doesn't select a row in the listbox before typing in the respective combo boxes and textboxes.....and hits save on my userform........the header row gets replaced with the data entered and messes things up. As the sheet needs to track totals etc.
    I tried locking the header row so that when the user gets a error message, it might prompt them to actually select a row in the listbox. Is there a way to
    1. Prevent information from being typed over the header row if a user starts entering info in the textboxes and then saves?
    2. Prevent a user from hitting the save button unless a row is selected for information to be typed.

    Thanks in advance

  • Re: Userform Listbox column heading

    Then open your own question according to the Forum Rules.

Participate now!

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