Hi.
I am having trouble showing source data in a listbox.
I use the below code to enter data from the userform to a worksheet, then the last two lines of code displays all data within a listbox. And this works ok.
But on first open of the userform i want the listbox to show the data already entered without needing to add more and using the code below.
I have edited the rowsource of the listbox to be 'ASamples'!A1:L6535 but this only shows data in the listbox from column 0, and doesnt show the other columns.
Any tips?
Thanks.
<strike></strike>
I am having trouble showing source data in a listbox.
I use the below code to enter data from the userform to a worksheet, then the last two lines of code displays all data within a listbox. And this works ok.
But on first open of the userform i want the listbox to show the data already entered without needing to add more and using the code below.
I have edited the rowsource of the listbox to be 'ASamples'!A1:L6535 but this only shows data in the listbox from column 0, and doesnt show the other columns.
Any tips?
Thanks.
Code:
Private Sub CommandButtonAddSample_Click()
Dim wks As Worksheet
Dim AddNew As Range
Set wks = Sheets("ASamples")
Set AddNew = wks.Range("A65356").End(xlUp).Offset(1, 0)
AddNew.Offset(0, 0).Value = txtA1.Text
AddNew.Offset(0, 1).Value = txtA2.Text
AddNew.Offset(0, 2).Value = txtA3.Text
AddNew.Offset(0, 3).Value = txtA4.Text
AddNew.Offset(0, 4).Value = txtA5.Text
AddNew.Offset(0, 9).Value = txtA6.Text
AddNew.Offset(0, 10).Value = txtA7.Text
lstDisplay.ColumnCount = 12
lstDisplay.RowSource = "'ASamples'!A1:L65356"
End Sub
<strike></strike>