Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 23
Default ListBox filter

Is it possible to restrict access/selection of a listbox item based on some
criteria? For example:

Listbox1
Oranges
Lemons
Apples
Grapes
Pears

I can't filter the list to show only the non-citrus. Therefore all of the
fruits show including the Oranges and Lemons. But , is it possible for me
to restrict the selection so that the user can only select Apples, Grapes,
or Pears?

I know I could code it in the command button after the user selects etc.
However, I want to cause the restriction within the listbox. Is that
possible?

GMet


  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11,123
Default ListBox filter

Hi GMet

Look here for a possible solution
http://www.contextures.com/xlDataVal02.html

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


"GMet" wrote in message ...
Is it possible to restrict access/selection of a listbox item based on some
criteria? For example:

Listbox1
Oranges
Lemons
Apples
Grapes
Pears

I can't filter the list to show only the non-citrus. Therefore all of the
fruits show including the Oranges and Lemons. But , is it possible for me
to restrict the selection so that the user can only select Apples, Grapes,
or Pears?

I know I could code it in the command button after the user selects etc.
However, I want to cause the restriction within the listbox. Is that
possible?

GMet




  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 983
Default ListBox filter

Why not populate the list box at the on click event. You can then, based on
whatever criteria you have selected, populate the list box with only the
relevant choices. Citrus fruits for example.

"GMet" wrote:

Is it possible to restrict access/selection of a listbox item based on some
criteria? For example:

Listbox1
Oranges
Lemons
Apples
Grapes
Pears

I can't filter the list to show only the non-citrus. Therefore all of the
fruits show including the Oranges and Lemons. But , is it possible for me
to restrict the selection so that the user can only select Apples, Grapes,
or Pears?

I know I could code it in the command button after the user selects etc.
However, I want to cause the restriction within the listbox. Is that
possible?

GMet



  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 983
Default ListBox filter

Sorry not the on click. More like the on change event and form initailze
events. The list will change dynamically depending on the criteria...

"GMet" wrote:

Is it possible to restrict access/selection of a listbox item based on some
criteria? For example:

Listbox1
Oranges
Lemons
Apples
Grapes
Pears

I can't filter the list to show only the non-citrus. Therefore all of the
fruits show including the Oranges and Lemons. But , is it possible for me
to restrict the selection so that the user can only select Apples, Grapes,
or Pears?

I know I could code it in the command button after the user selects etc.
However, I want to cause the restriction within the listbox. Is that
possible?

GMet



  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27,285
Default ListBox filter

Rebuild the list to show only the selections that are applicable.

--
Regards,
Tom Ogilvy

"GMet" wrote in message
...
Is it possible to restrict access/selection of a listbox item based on

some
criteria? For example:

Listbox1
Oranges
Lemons
Apples
Grapes
Pears

I can't filter the list to show only the non-citrus. Therefore all of the
fruits show including the Oranges and Lemons. But , is it possible for me
to restrict the selection so that the user can only select Apples, Grapes,
or Pears?

I know I could code it in the command button after the user selects etc.
However, I want to cause the restriction within the listbox. Is that
possible?

GMet






  #6   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 23
Default ListBox filter

OK - Good thoughts. The rowsource is currently set to a predefined range in
one of the workbook tabs. I think I may change that. I could create an
array (aMyFruits) based on the criteria and then set MyForm.ListBox1.List =
aMyFruits

GMet


"GMet" wrote in message
...
Is it possible to restrict access/selection of a listbox item based on

some
criteria? For example:

Listbox1
Oranges
Lemons
Apples
Grapes
Pears

I can't filter the list to show only the non-citrus. Therefore all of the
fruits show including the Oranges and Lemons. But , is it possible for me
to restrict the selection so that the user can only select Apples, Grapes,
or Pears?

I know I could code it in the command button after the user selects etc.
However, I want to cause the restriction within the listbox. Is that
possible?

GMet




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 filter listbox data in a form? Vinod Excel Discussion (Misc queries) 1 January 11th 10 02:01 PM
Setting and filter Listbox data Gizmo63 Excel Discussion (Misc queries) 1 February 5th 07 04:03 PM
Filter Listbox in user form Nikki[_3_] Excel Programming 0 August 29th 04 12:23 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 09:10 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"