ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   multi column list boxes (https://www.excelbanter.com/excel-programming/312960-multi-column-list-boxes.html)

JulieD

multi column list boxes
 
Hi All

haven't played with list boxes much at all ... and am now trying to
incorporate two into a userform .. with an "add" & "remove" button to move
records from one to the other - all this works fine but what i'ld like to do
is make one of the list boxes multi-columned and can't seem to figure it.

Scenario is i have a list of vessels in a combo box, once a vessel is
located all the containers on this vessel are listed in the first list box
(lst1). I then have a command button which when pressed populates the other
list box (lst2) with all the containers that have not yet been shipped.
This list is populated by code cycling through a range returning the
containers that do not have "shipped" in a column to the right of the
container number

for each cell in rng
if cell.offset(0,2).value < "shipped" then
userform11.lst2.additem cell.value
end if
next

however, some of these containers are assigned to other ships and some
haven't been assigned to anything. So what i'ld like to do is in lst2 also
show the vessel (if any) that they've been assigned to
(cell.offset(0,4).value) - the only examples of multi-column list boxes use
arrays, and as i don't know how many containers i could have at any one time
i don't know how to define the array.

Would appreciate any assistance.

Regards
JulieD




Tom Ogilvy

multi column list boxes
 
Userform11.ColumnCount = 2
for each cell in rng
if cell.offset(0,2).value < "shipped" then
userform11.lst2.additem cell.value
Userform11.Lst2.List(Userform11.lst2.Listcount-1,1) = _
cell.offset(0,4).Value
end if
next

--
Regards,
Tom Ogilvy


"JulieD" wrote in message
...
Hi All

haven't played with list boxes much at all ... and am now trying to
incorporate two into a userform .. with an "add" & "remove" button to move
records from one to the other - all this works fine but what i'ld like to

do
is make one of the list boxes multi-columned and can't seem to figure it.

Scenario is i have a list of vessels in a combo box, once a vessel is
located all the containers on this vessel are listed in the first list box
(lst1). I then have a command button which when pressed populates the

other
list box (lst2) with all the containers that have not yet been shipped.
This list is populated by code cycling through a range returning the
containers that do not have "shipped" in a column to the right of the
container number

for each cell in rng
if cell.offset(0,2).value < "shipped" then
userform11.lst2.additem cell.value
end if
next

however, some of these containers are assigned to other ships and some
haven't been assigned to anything. So what i'ld like to do is in lst2

also
show the vessel (if any) that they've been assigned to
(cell.offset(0,4).value) - the only examples of multi-column list boxes

use
arrays, and as i don't know how many containers i could have at any one

time
i don't know how to define the array.

Would appreciate any assistance.

Regards
JulieD






JulieD

multi column list boxes
 
Hi Tom

thanks for this ... will help a lot.

Cheers
JulieD

"Tom Ogilvy" wrote in message
...
Userform11.ColumnCount = 2
for each cell in rng
if cell.offset(0,2).value < "shipped" then
userform11.lst2.additem cell.value
Userform11.Lst2.List(Userform11.lst2.Listcount-1,1) = _
cell.offset(0,4).Value
end if
next

--
Regards,
Tom Ogilvy


"JulieD" wrote in message
...
Hi All

haven't played with list boxes much at all ... and am now trying to
incorporate two into a userform .. with an "add" & "remove" button to
move
records from one to the other - all this works fine but what i'ld like to

do
is make one of the list boxes multi-columned and can't seem to figure it.

Scenario is i have a list of vessels in a combo box, once a vessel is
located all the containers on this vessel are listed in the first list
box
(lst1). I then have a command button which when pressed populates the

other
list box (lst2) with all the containers that have not yet been shipped.
This list is populated by code cycling through a range returning the
containers that do not have "shipped" in a column to the right of the
container number

for each cell in rng
if cell.offset(0,2).value < "shipped" then
userform11.lst2.additem cell.value
end if
next

however, some of these containers are assigned to other ships and some
haven't been assigned to anything. So what i'ld like to do is in lst2

also
show the vessel (if any) that they've been assigned to
(cell.offset(0,4).value) - the only examples of multi-column list boxes

use
arrays, and as i don't know how many containers i could have at any one

time
i don't know how to define the array.

Would appreciate any assistance.

Regards
JulieD









All times are GMT +1. The time now is 12:25 PM.

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