Hi,
I hope someone can help me with this. I finally gave up. I am trying to populate a listbox with data from another excel file.
I have the listbox populated just fine but am able to get the 1st row as the header row. Please tell me what I'm doing wrong. My code is below:
Why can't I get the row A1 to display as the header?
I hope someone can help me with this. I finally gave up. I am trying to populate a listbox with data from another excel file.
I have the listbox populated just fine but am able to get the 1st row as the header row. Please tell me what I'm doing wrong. My code is below:
Code:
Private Sub CommandButton1_Click()
Dim lstbox As MSForms.ListBox
Dim rngsource As Range
Application.ScreenUpdating = False
'set reference to the range of data to be filled
conn_maindb
Set rngsource = maindb.Sheets(1).Range("A1:K50")
Set lstbox = frmReady.ListBox1
With lstbox
.ColumnCount = 11
.ColumnHeads = True
.List = rngsource.Cells.Value
End With
Application.ScreenUpdating = True
End Sub
Why can't I get the row A1 to display as the header?