![]() |
Listbox header inside VBA (Array("Head1", "Head2", ...)
Hi,
I would like to put a header into my ListBox but since the values inside the ListBox are calculated inside VBA, what is the best way to proceed? I tried to put ColumnHead = True but rowsource needs to be inside excel. Is there a way to add value from rowsource inside VBA instead like? Dim aHeaders as Variant aHeaders = Array("Head1", "Head2", ...) Me.ListBox1.RowSource = aHeaders Actally, value are added as: For i = 0 To 10 Me.ListBox1.AddItem fTableValue(i+1,1) Me.ListBox1.List(i, 1) = fTableValue(i+1,2) Next i Maybe i = 0 could be the header.. but I cannot put these cells in gray... Thanks a lot! -- Alex St-Pierre |
Listbox header inside VBA (Array("Head1", "Head2", ...)
AFAIK, you can not add headers in vba. This can only be done if the
information is on a worksheet and you are using the RowSource property. -- HTH, Gary Brown If this post was helpful to you, please select ''YES'' at the bottom of the post. "Alex St-Pierre" wrote: Hi, I would like to put a header into my ListBox but since the values inside the ListBox are calculated inside VBA, what is the best way to proceed? I tried to put ColumnHead = True but rowsource needs to be inside excel. Is there a way to add value from rowsource inside VBA instead like? Dim aHeaders as Variant aHeaders = Array("Head1", "Head2", ...) Me.ListBox1.RowSource = aHeaders Actally, value are added as: For i = 0 To 10 Me.ListBox1.AddItem fTableValue(i+1,1) Me.ListBox1.List(i, 1) = fTableValue(i+1,2) Next i Maybe i = 0 could be the header.. but I cannot put these cells in gray... Thanks a lot! -- Alex St-Pierre |
All times are GMT +1. The time now is 06:20 AM. |
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com