Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 9
Default Linking Cells to ListBox - How?

Is it possible to link a range of cells to a listbox: i.e. when code
executes a show method the list box displays the contents of the linked
cells.

Bill
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 135
Default Linking Cells to ListBox - How?

William,

At design-time you can set the 'RowSource' property of the listbox in the
properites window of the listbox to a named range of the Workbook. Or you
can do the same at runtime using the listbox's RowSource property, eg.,

Form1.Listbox1.RowSource = "MyRange"

Or, define and name the range at runtime, eg.,

Range("A1:A10").Name = "MyRange"
Form1.Listbox1.RowSource = "MyRange"
Form1.Show

Or, if you pefer not to name the range (naming the range results in the
workbook containing that named range), you can just define the range and
fill the listbox item by item, eg.,

Dim cell As Range
For each cell in Range("A1:A10")
Form1.Listbox1.AddItem (cell.Value)
Next cell
Form1.Show

HTH,
Shockley

"William C. Smith" <wcsmithx*xieee.org wrote in message
...
Is it possible to link a range of cells to a listbox: i.e. when code
executes a show method the list box displays the contents of the linked
cells.

Bill



  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 9
Default Linking Cells to ListBox - How?

"shockley" wrote in news:4lnHb.31879$d36.27989
@news01.roc.ny:

At design-time you can set the 'RowSource' property of the listbox in the


Thank you. I had been to the Properties Window, but how to use it is not
obvious. After your help I still had to experiment to find the right way to
insert a name in the value field. Help was no help.

Again Thank You.
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
protect cells after listbox selection Chay Excel Discussion (Misc queries) 2 December 2nd 06 11:32 PM
protect cells after listbox selection Chay Excel Discussion (Misc queries) 0 November 30th 06 06:50 PM
listbox.value not equal to listbox.list(listbox.listindex,0) ARB Excel Programming 0 October 22nd 03 12:46 AM
Is refreshing listbox rowsource in listbox click event possible? Jeremy Gollehon[_2_] Excel Programming 4 September 25th 03 06:45 PM
Sorting ListBox results or transposing ListBox values to other cells for sorting Rob[_8_] Excel Programming 1 July 9th 03 04:35 AM


All times are GMT +1. The time now is 03:46 PM.

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"