Here's my code...
-------------------
'Variables declared in main module though
Public Cars As Object
Public Row As Integer
Set Cars = Sheets("Data").Cells
Public I as Integer
Private Sub UserForm_Initialize()
Row = 5
While Not IsEmpty(Cars(Row, 1))
ListCars.AddItem (Cars(Row, 1))
ListCars.Column(1, I) = (Cars(Row, 2))
ListCars.Column(2, I) = (Cars(Row, 3))
ListCars.Column(3, I) = (Cars(Row, 4))
ListCars.Column(4, I) = (Cars(Row, 5))
ListCars.Column(5, I) = (Cars(Row, 6))
ListCars.Column(6, I) = (Cars(Row, 7))
ListCars.Column(7, I) = (Cars(Row, )
ListCars.Column(8, I) = (Cars(Row, 9))
ListCars.Column(9, I) = (Cars(Row, 10))
I = I + 1
Row = Row + 1
Wend
End Sub
------------
Okay, ListCars is the listbox name. It has 10 columns. Cars refers to the sheet with the data on it. The data imported starts at row 5 in the worksheet. I want row 1 of the worksheet to be my columnheads.
How do I make that happen?
#2
Packing Heat,
I am learning VBA, John can answer better than I, but here goes.
Have you tried this:
ListCars.ColumnHeads = True 'Should display column heads
Note what VBA help says:
"Headings in combo boxes appear only when the list drops down.
Remarks
When the system uses the first row of data items as column headings, they can't be selected."
Never tried it, hope this helps
Scott
I am learning VBA, John can answer better than I, but here goes.
Have you tried this:
ListCars.ColumnHeads = True 'Should display column heads
Note what VBA help says:
"Headings in combo boxes appear only when the list drops down.
Remarks
When the system uses the first row of data items as column headings, they can't be selected."
Never tried it, hope this helps
Scott