Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 6
Default How to add selected row into listbox?

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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default How to add selected row into listbox?


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
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
How to set the selected state of an embedded ActiveX listbox [email protected] Excel Discussion (Misc queries) 1 February 5th 07 09:30 PM
ListBox Selected Items into an Array jtp550 Excel Programming 3 September 28th 05 12:44 AM
How to copy selected listbox item to sheet michdan Excel Programming 1 July 14th 05 12:49 PM
Transposing a rng selected from a listbox JoeH[_7_] Excel Programming 4 September 12th 04 03:26 AM
Count number of selected item in Listbox Todd Huttenstine Excel Programming 4 June 14th 04 06:54 PM


All times are GMT +1. The time now is 10:16 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"