ListBox item to cell

S

Soniya

Hi All,

I have a combobox and klistbox in my userform.
when the user form changes some items are added to the
list box (no of items varies)

how can i get all the list box items in my sheet2 column
b and combobox1 item in column A?

for eg if i have tree items in list box in my column A i
have to get combobox value 3 times and listbox item
corresponding to it.

like if my combobox1.value is 10 and listbox1. list is
1,2,3 then

columnA column B
10 1
10 2
10 3

TIA
Soniya
 
D

Dick Kusleika

Soniya

Try this

Dim i as Long

For i = 0 to Me.ListBox1.ListCount - 1
If Me.ListBox1.Selected(i) Then
Sheet2.Cells(i+1,1).Value = Me.ComboBox1.Value
Sheet2.Cells(i+1,2).Value = Me.ListBox1.List(i)
End If
Next i
 

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