list box

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

I need to fill a range from a two column list box a3:a10 needs to populated
by one of the selection in the two column list. I can get the list box to
work, but have been unavble to link the list box to the cell range.
 
I don't believe you can link a single listbox to more than one cell. You
can do this with code

Private Sub Commandbutton1_click()
Dim i as Long, j as Long, sh as Worksheet
j = 2
set sh = worksheets("sheet2")
with userform1.Listbox1
for i = 0 to .Listcount - 1
if .Selected(i) then
j = j + 1
sh.Cells(j,1).Value = .List(i,0)
sh.Cells(j,2).value = .List(i,1)
end if
Next
End with
End Sub

Untested, but this should do what you want
 

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

Back
Top