Home |
Search |
Today's Posts |
|
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Hi there,
i need a little bit help, i would like to know how to add selected row into listbox? Can anyone help me? thanx |
#2
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]() Hello frankosun, There are 2 types of ListBoxes. The Forms ListBox and the Control Toolbox ListBox. The Forms ListBox can display only a single column. The Control Toobox ListBox can have multiple columns. A1:A10 hold 1, 2, 3, 4, 5, 6, 7, 8, 9, 10 B1:B10 hold 11, 12, 13, 14, 15, 16, 17 ,18, 19, 20 LOADING THE FORMS LISTBOX FROM A RANGE: Dim MyArray () Dim MyRange As Range Set MyRange = Worksheets("Sheet1").Range("A1:B10") MyArray = MyRange With Shapes("List Box 1").ControlFormat ..RemoveAllItems For Each element In MyArray ..AddItem element Next element End With LOADING THE CONTROL TOOLBOX LISTBOX FROM A RANGE: Dim MyArray () Dim MyRange As Range Set MyRange = Worksheets("Sheet1").Range("A1:B10") MyArray = MyRange ListBox1.List = MyArray Because the range contains 2 columns the Control Toolbox ListBox will also contain 2 columns. The ColumnCount property controls how many columns will be visible in the ListBox. Sincerely, Leith Ross -- Leith Ross ------------------------------------------------------------------------ Leith Ross's Profile: http://www.excelforum.com/member.php...o&userid=18465 View this thread: http://www.excelforum.com/showthread...hreadid=494382 |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
How to set the selected state of an embedded ActiveX listbox | Excel Discussion (Misc queries) | |||
ListBox Selected Items into an Array | Excel Programming | |||
How to copy selected listbox item to sheet | Excel Programming | |||
Transposing a rng selected from a listbox | Excel Programming | |||
Count number of selected item in Listbox | Excel Programming |