?
Solved

Excel listbox with headers

Posted on 2014-12-19
5
Medium Priority
?
109 Views
Last Modified: 2015-01-05
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.

Thanks

Rgds
0
Comment
Question by:James Elliott
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
5 Comments
 
LVL 85

Accepted Solution

by:
Rory Archibald earned 1000 total points
ID: 40509328
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.
0
 
LVL 34

Assisted Solution

by:Norie
Norie earned 1000 total points
ID: 40509333
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.
0
 
LVL 18

Expert Comment

by:krishnakrkc
ID: 40512396
You can write the recordset data directly into cells and refer the range into the listbox rowsource. No loop needed.

Kris
0
 
LVL 18

Expert Comment

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

Kris
0
 
LVL 12

Author Closing Comment

by:James Elliott
ID: 40531581
Sorry for the delay.
0

Featured Post

New benefit for Premium Members - Upgrade now!

Ready to get started with anonymous questions today? It's easy! Learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

This article will guide you to convert a grid from a picture into Excel format using Microsoft OneNote and no other 3rd party application.
If you need to forecast numbers -- typically for finance -- the Windows and Mac versions of Excel 2016 have a basket of tools to get the job done.
This Micro Tutorial will demonstrate in Google Sheets how to use the HYPERLINK function to create live links inside your spreadsheet.
Many functions in Excel can make decisions. The most simple of these is the IF function: it returns a value depending on whether a condition you describe is true or false. Once you get the hang of using the IF function, you will find it easier to us…

752 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question