Setting list box contents

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
 
R

Ron de Bruin

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
 
O

onedaywhen

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

--
 
P

Pete

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