Excel listbox with headers

Hi All,

Excel 2007

I have a listbox on a userform that I'm populating by looping through a recordset.

Because this is excel and not access, I cannot set the rowsource of the listbox to anything other than a range, and so I'm currently not seeing any headers.

Does anyone know of a way around this programmatically? I'm not particularly enthusiastic about creating a temporary area / range for my recordset just so that it can be a rowsource.


LVL 12
James ElliottManaging DirectorAsked:
Who is Participating?
Rory ArchibaldConnect With a Mentor Commented:
You can only have proper headers if you use a range. Beyond that you have to fudge it using either the first row of the list as headers (with code to prevent selecting it) or use labels or another listbox above the listbox to present the headers.
NorieConnect With a Mentor VBA ExpertCommented:
Use a small, one row listbox with the same column widths as the main listbox, populate it with the headers and place it just above the main listbox.
You can write the recordset data directly into cells and refer the range into the listbox rowsource. No loop needed.

Please ignore my above post, I haven't fully read your question :(

James ElliottManaging DirectorAuthor Commented:
Sorry for the delay.
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.