RowSource as a row

  • Thread starter Thread starter Boba
  • Start date Start date
B

Boba

Hi;
what is the proper syntax for RowSource:
ListBox1.RowSource=Range("A1:L1")
gives me just A1 cell as the only element
in the ListBox.List. Thanks. Boba
 
you can try this

Private Sub UserForm_Activate()
Dim ws As Worksheet
Dim i As Long
Set ws = Worksheets("Sheet1")
For i = 1 To 12
Me.ListBox1.AddItem ws.Cells(1, i)
Next
End Sub
 
You only have one row in A1:L1.

If you want each of the values in A1:L1 as your list:

listbox1.list = application.transpose(range("a1:L1").value)
 
Try something more like this...

ListBox1.RowSource=Sheets("Sheet1").Range("A1:L1").Address
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Similar Threads


Back
Top