Home |
Search |
Today's Posts |
#5
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Harald,
Thanks a lot - it works nicely. KL -----Original Message----- Problem is that the header row should not be included in the rowsource. This works here with row 1 as header row: Private Sub UserForm_Initialize() Dim R As Range Dim L As Long, C As Long L = Sheets("DBASE").Cells(10000, 1).End(xlUp).Row C = Sheets("DBASE").UsedRange.Columns.Count Set R = Sheets("DBASE").Cells(2, 1).Resize(L, C) With ListBox1 .ColumnCount = C .RowSource = "DBASE!" & R.Address .ColumnHeads = True End With End Sub HTH. Best wishes Harald "KL" skrev i melding ... Harald, thanks for the quick reply. What if I do the below? How would I then set the first row values to populate the column headings? Thanks. ------------Code Start------------ Private Sub UserForm_Initialize() cCounter = Sheets("DBASE").UsedRange.Columns.Count myRange = Sheets("DBASE").UsedRange.Address lb1.RowSource = myRange lb1.ColumnHeads = True lb1.ColumnCount = cCounter End Sub ------------Code End------------ -----Original Message----- Hi Listbox column headers work only when a listbox' Listfillrange / Rowsource is set to a range of cells that has a header row. You can't do it populating by code. HTH. best wishes Harald "KL" skrev i melding ... Hi there, I am using the following code to populate a listbox with multiple-column entries. My problem is I can't find a way to populate the columns' headers too. Any ideas muchly appreciated. KL . . |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
Populating listbox | Excel Discussion (Misc queries) | |||
Populating listbox | Excel Programming | |||
Populating a ListBox | Excel Programming | |||
populating a multi-column Listbox | Excel Programming | |||
populating a multi-column Listbox | Excel Programming |