GZGQ.COM welcome to my space |
HOME ListBox Columnheader |
| ListBox Columnheader | | Published by: mike 2008-11-20 |
| | I have a UserForm which contains a ListBox. The ListBox.ColumnCount = 2 and the .ColumnHeads = True. Is there any way I can put a Caption in the ColumnHeads? Somebody has a clue? :freak:
Any input will be appreciated.
Regards,
Wimchester
I'm only a 'newbie' myself but I think.....
If your 'listfillrange' carries a heading in the cell immediately above the list, that string will be used as the column header.
hope it helps.
rgds
remalay
Example attached.
rgds
remalay :ylinfant: Henry Hahn : Building a Multi-Column ListBox in Avalon:: For selection, I'll just use a ListBox; that's its whole purpose in life. For the column headers and sizing to the largest item in the column I'm going to http://blogs.msdn.com/henryh/archive/2005/06/23/431846.aspxHOME |
Thanks for the reply. Your example makes sence. However....
my ListBox is on a UserForm instead of a Sheet. The data in my ListBox does not come from a Range, but the ListBox is filled with the following code:
Dim Batch As Object
Dim i As Integer
Set Batch = GetObject(ThisWorkbook.Path & "Machine data TL260-D.bch") 'This filename is hardcoded for testing purposes
ListBox1.ColumnCount = 2
For i = 1 To Batch.Rows
If Len(Batch.Row(i).Formatted("Batch Reference")) > 0 Then
With ListBox1
.AddItem Batch.Row(i).Formatted("Batch Reference")
.List(i - 1, 1) = Batch.Row(i).Formatted("Sample Reference")
.Selected(i - 1) = True
End With
End If
Next i
Set Batch = Nothing
So I need to know how to set the caption for the columns by code
Regards,
Wimchester
Traditional University or MLM University? You Choose
15 Questions to Ask Your Software Vendor
|
|