ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   list box (https://www.excelbanter.com/excel-programming/312428-list-box.html)

Bryan

list box
 
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.

Tom Ogilvy

list box
 
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

--
Regards,
Tom Ogilvy


"Bryan" wrote in message
...
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.





All times are GMT +1. The time now is 01:21 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com