View Single Post
  #1   Report Post  
Posted to microsoft.public.excel.programming
KL[_4_] KL[_4_] is offline
external usenet poster
 
Posts: 3
Default Populating Column Headers in a ListBox

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

-------------Code Start--------------
Dim MyArray()

Private Sub UserForm_Initialize()
Dim r As Single
cCounter = Sheets("DBASE").UsedRange.Columns.Count - 1
rCounter = Sheets("DBASE").UsedRange.Rows.Count - 1
ReDim MyArray(rCounter, cCounter)

lb1.ColumnCount = cCounter + 1

'Load values MyArray
For r = 0 To rCounter
For c = 0 To cCounter
MyArray(r, c) = Sheets
("DATABASE").UsedRange.Cells(r + 2, c + 1)
Next c
Next r

'Load ListBox1
lb1.List() = MyArray
End Sub
-------------Code Start--------------