multi colum listbox

A

alexanderd

i am trying to create a list box with more than one colum, to no avail
having trawled the site i can not find anything which fits the bill
can any one point me in the right direction.
i am using an excel database with 4 colums and approx 1000 rows. th
aim is to select 1 row of data to work on.

any suggestions!
 
B

Bob Phillips

Listboxes are multi-column, just set the columncount property to 4, and set
the link range to your data.

--

HTH

Bob Phillips
... looking out across Poole Harbour to the Purbecks
(remove nothere from the email address if mailing direct)
 
A

alexanderd

un fortunately i was unable to resolve the problem i have with havin
more than one colum in a list box, having done as you suggested to n
avail i have included coppies of the files that i am using and any hel
you can give would be appreciated.
the text box is filled by concatanate of the attached file i
ZZPLAY.xls

what i am attempting to do is to select a row in the list box and plac
the the resultant in the spread sheet behind the form. at present the
boxes are filled manually and then transfered to the spread sheet.

hoping you can hel

Attachment filename: zzplay.xls
Download attachment: http://www.excelforum.com/attachment.php?postid=56297
 
B

Bob Phillips

If you want

--

HTH

Bob Phillips
... looking out across Poole Harbour to the Purbecks
(remove nothere from the email address if mailing direct)
 
B

Bob Phillips

If you want to populate a 3 column listbox from a worksheet, the worksheet
should also be 3 columns, e.g.

Dim myarray
myarray = ActiveSheet.Range("E3:G5")
Me.ListBox1.List() = myarray

and to get the values use

With Me.ListBox1
MsgBox .List(.ListIndex, 0) & ", " & _
.List(.ListIndex, 1) & ", " & _
.List(.ListIndex, 2)
End With

--

HTH

Bob Phillips
... looking out across Poole Harbour to the Purbecks
(remove nothere from the email address if mailing direct)
 
A

alexanderd

i substituted the following as you suggested also oppening the sourc
sheet for the array

Private Sub UserForm_Initialize()
Dim myarray
myarray = ActiveSheet.Range("A2:C250")
Me.ListBox1.List() = myarray
With Me.ListBox1
MsgBox .List(.listindex, 0) & ", " & _
.List(.listindex, 1) & ", " & _
.List(.listindex, 2)
End With

End Sub
i now recieve the following error message
RUN Time error
could not get list property, invalid property index

what have i done wron
 
B

Bob Phillips

Alexander,

You omitted some dots. This line

MsgBox .List(.listindex, 0) & ", " & _
List(.listindex, 1) & ", " & _
List(.listindex, 2)

should be

MsgBox .List(.listindex, 0) & ", " & _
..List(.listindex, 1) & ", " & _
..List(.listindex, 2)

--

HTH

Bob Phillips
... looking out across Poole Harbour to the Purbecks
(remove nothere from the email address if mailing direct)
 
A

alexanderd

many thanks for your help but by going from site to site i have foun
exacly what i wanted. i found this gem and many others at
http://www.erlandsendata.no/ site lots of goodies and well worth
visit.
thank you once again for all your help;
 
Top