Hi Folks,
I am using the following code to place information into a listbox within a userform. Please could someone explain to me how i need to set it so that the listbox shows headers.
The headers are contained in row 4.
I have tried to search this forum and looked on the net but unable to find anything that i fully understand in order to do this. I have also had a play myself but no luck and i am not really sure with listboxes yet.
I would appreciate the help
Thanks
I am using the following code to place information into a listbox within a userform. Please could someone explain to me how i need to set it so that the listbox shows headers.
The headers are contained in row 4.
I have tried to search this forum and looked on the net but unable to find anything that i fully understand in order to do this. I have also had a play myself but no luck and i am not really sure with listboxes yet.
Code:
Private Sub UserForm_Initialize()
'This code places the information into the Schedule ListBox1
Dim PRL As Worksheet
Dim I As Long
Dim LastRow As Long
Dim MyArray
Set PRL = Sheets("Priority List")
LastRow = PRL.Range("A65536").End(xlUp).Row
ReDim MyArray(LastRow - 3, 4)
'The 1st list box contains 3 data columns
ListBox1.ColumnCount = 5
For I = 0 To LastRow - 4
MyArray(I, 0) = PRL.Range("A" & I + 4) 'Order Number
MyArray(I, 1) = PRL.Range("B" & I + 4) 'Quantity to Pack
MyArray(I, 2) = PRL.Range("C" & I + 4) 'Title
MyArray(I, 3) = PRL.Range("D" & I + 4) 'Due
MyArray(I, 4) = PRL.Range("F" & I + 4) 'Status
Next I
ListBox1.List() = MyArray
End Sub
Thanks