View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
Jim Thomlinson[_4_] Jim Thomlinson[_4_] is offline
external usenet poster
 
Posts: 1,119
Default Populating a listbox with values from a sheet.

Without seeing any of your code this will have to be kind of generic. It
should look something like this...

sub PopulateListBox(byval MyArray() as string)
dim intCounter as integer

listbox1.clear
for intcounter = lbound(MyArray) to ubound(myArray)
listbox1.additem myArray(intcounter)
next intcounter
end sub
--
HTH...

Jim Thomlinson


"shenlingstyle" wrote:


Hi everyone, hope you can help me with this one. I'm not very familiar
with how listboxes work and how to write code for them. My situation is
as below:

I have a sheet with a bunch of airline names, there may be more than 1
of the same airline in the same column. What I've been able to do so
far is make an array and have it hold all the unique airline names. I
want to then populate the listbox on a form with these airlines so the
user can select as many airlines as he wants to do some more
calculations.

So basically I'm not sure how to write code for the listbox to make it
retrieve the data from the array.

Hope I explained it properly. Any suggestions are welcome. Thanks a
bunch.

Colin


--
shenlingstyle
------------------------------------------------------------------------
shenlingstyle's Profile: http://www.excelforum.com/member.php...o&userid=27672
View this thread: http://www.excelforum.com/showthread...hreadid=486888