list box

T

TimO

Hello All,

I have created a userform where the user makes inputs
into a text box that populates a list box. There can be
multiple inputs into the list box. My question
is.....once I have multiple inputs into the list box, how
do I recognize each individual entry and transfer them to
my excel sheet? I can populate the listbox, but I am
stuck after that.

Thanks in advance.
 
T

Tom Ogilvy

Dim rw as Long, i as long
rw = 24

for i = 0 to listbox1.listcount - 1
cells(rw,1) = listbox1.list(i)
rw = rw + 1
Next
 
G

Guest

Tim,

Here is something of the top of my head. It may not be perfext, but it will
get you started... The name of my list box is "lstListBox".

Sub PostListBoxEntries()
Dim i as Integer

For i = 0 to lstListBox.Listcount - 1
ActiveCell.Offset(i,0).Value = lstListBox.List(i)
Next

End Sub

List box entries are addressed by index; the first being index 0. Listcount
returns the number of entries in the list, which is one greater than the
greatest index, hence the "- 1" in the loop.

Hope this works for you.

Dale
 

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

Top