How can Rowsource be used for a combobox on a form?
Hi,
Suppose the list of items you're after are in column A, and suppose
that your list will never be longer than 100 items, which is very
reasonable for a picklist...
Than you can select a range in column A that is bigger than the longest
expected length and add the items untill you meet a blank cell...
This is the startup-procedure for the Userform Try1 that fills Listbox1
with the items found in tha range
ThisWorkbook.Sheets("1").Range("a1:a200")
Private Sub UserForm_Activate()
Dim list1 As Variant
With ThisWorkbook.Sheets("1")
list1 = .Range("a1:a200")
End With
i = 1
For i = 1 To 200
If list1(i, 1) = "" Then
Exit Sub
End If
With Try1.ListBox1
..AddItem (list1(i, 1))
End With
Next
End Sub
Ofcourse you can refine this further...
Bye
Baj
|