PDA

View Full Version : Userforms, Listboxes, Virtual space.



magelan
03-11-2013, 09:56 AM
Hi All,

difficult question time.

I want to make a listbox and have the column headings display A, B, C, D, E, etc. The true column headers.

I've figured the way to do this is to copy the data and insert A, B, C, D, E etc, above it. However, I do -not- want to make a new worksheet and physically copy it. This feels clumsy and archaic.

How can I go about making a range source in virtual space so that I can avoid storing my data on a worksheet just to get some proper column headings on it? Never mind the fact that setting column headings should not force you to base it on "the row above your range source".

Kenneth Hobs
03-11-2013, 11:35 AM
I would not use Userform1.Listbox1.ColumnHeads=True. I would just set the first row as a pseudo header. e.g. http://vbaexpress.com/forum/showthread.php?p=169149

magelan
03-11-2013, 11:54 AM
I would not use Userform1.Listbox1.ColumnHeads=True. I would just set the first row as a pseudo header. e.g. http://vbaexpress.com/forum/showthread.php?p=169149

I think thats what I'm going to wind up doing, is to use .additem rather than .rowsource.

However, I would very much like to retain the grid lines on the first row... the data is not scrollable as it only ever shows 5-10 lines and the listbox is tall enough to not scroll down, but I'd really like something to distinguish my top row as headers. Any hints?

Kenneth Hobs
03-11-2013, 12:19 PM
You are limited by the control. Try the ListView control.

http://dailydoseofexcel.com/archives/2006/12/26/listview/

magelan
03-11-2013, 01:09 PM
Ouch...i got my hopes up for that one, after seeing what it looked like, its PERFECTION!!! However, i cannot go around and install the required .ocx files on everyones computer

=(

oh well. Guess i'm stuck with a super ugly listbox.