Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2
Default How access a listbox on a worksheet

Hello.
I have a listbox allocated on a worksheet, not on a form.
I set input range and linked cell through properties window.

How can i access the listbox from macro? For example, access selected item in it.

Thanks
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11,123
Default How access a listbox on a worksheet

Hi AsIs

This will give you the selected item

MsgBox Sheets("Sheet1").ListBox1.Value


--
Regards Ron de Bruin
http://www.rondebruin.nl


"AsIs" wrote in message ...
Hello.
I have a listbox allocated on a worksheet, not on a form.
I set input range and linked cell through properties window.

How can i access the listbox from macro? For example, access selected item in it.

Thanks



  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2
Default How access a listbox on a worksheet

Thanks for the answer.
But the problem still exists.

I use locale version (russian) and my listbox name isn't ListBox1, but with russian symbols. Besides the name contains spaces.

So, can I get control's reference with other method. May be using enumerations (or collection) of the all controls on the worksheet.

Addition: I can't see this object in dropdown list followed by sheet's name and dot, and can't see it in the dropdown list of objects (left - upper corner).


"Ron de Bruin" wrote:

Hi AsIs

This will give you the selected item

MsgBox Sheets("Sheet1").ListBox1.Value


--
Regards Ron de Bruin
http://www.rondebruin.nl


"AsIs" wrote in message ...
Hello.
I have a listbox allocated on a worksheet, not on a form.
I set input range and linked cell through properties window.

How can i access the listbox from macro? For example, access selected item in it.

Thanks




  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 599
Default How access a listbox on a worksheet

AsIs

If the listbox is from the Forms toolbar, it is part of the Shapes
collection

Sheet1.Shapes(1).Value

or the ListBoxes collection

Sheet1.ListBoxes(1).Value

The ListBoxes collection is deprecated (no longer supported), but it still
works.

If the listbox is from the Control Toolbar (Active X), then it's part of the
OLEObjects collection

Sheet1.OLEObjects(1).Value
Sheet1.OLEObjects("ListBox1").Value

--
Dick Kusleika
MVP - Excel
Excel Blog - Daily Dose of Excel
www.dicks-blog.com

"AsIs" wrote in message
...
Thanks for the answer.
But the problem still exists.

I use locale version (russian) and my listbox name isn't ListBox1, but

with russian symbols. Besides the name contains spaces.

So, can I get control's reference with other method. May be using

enumerations (or collection) of the all controls on the worksheet.

Addition: I can't see this object in dropdown list followed by sheet's

name and dot, and can't see it in the dropdown list of objects (left - upper
corner).


"Ron de Bruin" wrote:

Hi AsIs

This will give you the selected item

MsgBox Sheets("Sheet1").ListBox1.Value


--
Regards Ron de Bruin
http://www.rondebruin.nl


"AsIs" wrote in message

...
Hello.
I have a listbox allocated on a worksheet, not on a form.
I set input range and linked cell through properties window.

How can i access the listbox from macro? For example, access selected

item in it.

Thanks






  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11,123
Default How access a listbox on a worksheet

AFAIK you can't have spaces in the name of a listbox
When you are in the design mode press the properties button
Try to rename the button there and you see it is not allowed to use spaces

--
Regards Ron de Bruin
http://www.rondebruin.nl


"AsIs" wrote in message ...
Thanks for the answer.
But the problem still exists.

I use locale version (russian) and my listbox name isn't ListBox1, but with russian symbols. Besides the name contains spaces.

So, can I get control's reference with other method. May be using enumerations (or collection) of the all controls on the

worksheet.

Addition: I can't see this object in dropdown list followed by sheet's name and dot, and can't see it in the dropdown list of

objects (left - upper corner).


"Ron de Bruin" wrote:

Hi AsIs

This will give you the selected item

MsgBox Sheets("Sheet1").ListBox1.Value


--
Regards Ron de Bruin
http://www.rondebruin.nl


"AsIs" wrote in message ...
Hello.
I have a listbox allocated on a worksheet, not on a form.
I set input range and linked cell through properties window.

How can i access the listbox from macro? For example, access selected item in it.

Thanks








  #6   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27,285
Default How access a listbox on a worksheet

Sheet1.OLEObjects(1).Value
Sheet1.OLEObjects("ListBox1").Value


probably was meant to be
Sheet1.OLEObjects(1).Object.Value
Sheet1.OLEObjects("ListBox1").Object.Value

--
Regards,
Tom Ogilvy


"Dick Kusleika" wrote in message
...
AsIs

If the listbox is from the Forms toolbar, it is part of the Shapes
collection

Sheet1.Shapes(1).Value

or the ListBoxes collection

Sheet1.ListBoxes(1).Value

The ListBoxes collection is deprecated (no longer supported), but it still
works.

If the listbox is from the Control Toolbar (Active X), then it's part of

the
OLEObjects collection

Sheet1.OLEObjects(1).Value
Sheet1.OLEObjects("ListBox1").Value

--
Dick Kusleika
MVP - Excel
Excel Blog - Daily Dose of Excel
www.dicks-blog.com

"AsIs" wrote in message
...
Thanks for the answer.
But the problem still exists.

I use locale version (russian) and my listbox name isn't ListBox1, but

with russian symbols. Besides the name contains spaces.

So, can I get control's reference with other method. May be using

enumerations (or collection) of the all controls on the worksheet.

Addition: I can't see this object in dropdown list followed by sheet's

name and dot, and can't see it in the dropdown list of objects (left -

upper
corner).


"Ron de Bruin" wrote:

Hi AsIs

This will give you the selected item

MsgBox Sheets("Sheet1").ListBox1.Value


--
Regards Ron de Bruin
http://www.rondebruin.nl


"AsIs" wrote in message

...
Hello.
I have a listbox allocated on a worksheet, not on a form.
I set input range and linked cell through properties window.

How can i access the listbox from macro? For example, access

selected
item in it.

Thanks







  #7   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 66
Default How access a listbox on a worksheet

Yep. Thanks.

Dick

Tom Ogilvy wrote:
Sheet1.OLEObjects(1).Value
Sheet1.OLEObjects("ListBox1").Value


probably was meant to be
Sheet1.OLEObjects(1).Object.Value
Sheet1.OLEObjects("ListBox1").Object.Value


"Dick Kusleika" wrote in message
...
AsIs

If the listbox is from the Forms toolbar, it is part of the Shapes
collection

Sheet1.Shapes(1).Value

or the ListBoxes collection

Sheet1.ListBoxes(1).Value

The ListBoxes collection is deprecated (no longer supported), but it
still works.

If the listbox is from the Control Toolbar (Active X), then it's part of
the OLEObjects collection

Sheet1.OLEObjects(1).Value
Sheet1.OLEObjects("ListBox1").Value

--
Dick Kusleika
MVP - Excel
Excel Blog - Daily Dose of Excel
www.dicks-blog.com

"AsIs" wrote in message
...
Thanks for the answer.
But the problem still exists.

I use locale version (russian) and my listbox name isn't ListBox1, but

with russian symbols. Besides the name contains spaces.

So, can I get control's reference with other method. May be using

enumerations (or collection) of the all controls on the worksheet.

Addition: I can't see this object in dropdown list followed by sheet's

name and dot, and can't see it in the dropdown list of objects (left -
upper corner).


"Ron de Bruin" wrote:

Hi AsIs

This will give you the selected item

MsgBox Sheets("Sheet1").ListBox1.Value


--
Regards Ron de Bruin
http://www.rondebruin.nl


"AsIs" wrote in message

...
Hello.
I have a listbox allocated on a worksheet, not on a form.
I set input range and linked cell through properties window.

How can i access the listbox from macro? For example, access selected
item in it.

Thanks



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
error 13 when setting worksheet listbox Amedee Van Gasse Excel Discussion (Misc queries) 1 September 24th 08 02:06 PM
listbox B conditional of input in Listbox A Kim K Excel Discussion (Misc queries) 1 October 31st 06 08:27 PM
Help! Activate worksheet from a listbox Bob Phillips Excel Worksheet Functions 0 May 18th 05 09:09 AM
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


All times are GMT +1. The time now is 11:56 PM.

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

About Us

"It's about Microsoft Excel"