Setting list box contents

  • Thread starter Thread starter P Dudesek
  • Start date Start date
P

P Dudesek

Here is what I am trying to do.

I have a worksheet named Vendor List

Cells D4 to D33 contain the data

Now I want to create a userform (i know how to do that)
with a
list box (know how to do that) but what I can not figure
out
is how to get that D4 to D33 data into the listbox for the
user to select. Valadation is no good in this instance
because
I want to be able to insert the users selection in
different
worksheets.

Thanks
 
You can copy this event in the Userform mudule to fill your listbox

Private Sub UserForm_Initialize()
ListBox1.List = Sheets("Sheet1").Range("d4:d33").Value
End Sub
 
Set the Rowsource property of the listbox on the userform to the
following.....
(Change the sheet to the one with the list data)

Sheet1!D43:D33

Alternatively programmatically fill the list box by use the .additem method
and reading the data range. This method is more elegant and allows the
range to expand and contract as controlled by the range definition in your
programme.

Cheers
N.
 
Alternatively programmatically fill the list box by use the .additem method
and reading the data range.

Using the ListBox's list method is quicker i.e.

ListBox1.List = Range("D4:D33").Value

--
 
Thanks Ron, That is what I have been trying to do. I am trying to learn
this by myself. But that had me stumped.
 
Back
Top