LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #1   Report Post  
Posted to microsoft.public.excel.programming
Liz Liz is offline
external usenet poster
 
Posts: 133
Default Using a List Box to filter another List Box

Hi,
I have two multi-select listboxes. The selections from ListBox 1 will
determine the and filter the available choices for Listbox 2.
I do have code that works when a combobox is used as the source to filter a
listbox. But I am not sure how I can modify it to accommodate a multi-select
listbox as the source.
Thanks for your help!

My code is below which works when a single select combo box is used as the
source:

Private Sub cboxProductLine_Change()
Dim myRng As Range
Dim myCell As Range
If Me.cboxProductLine.ListIndex < 0 Then
Me.lstProductFiltered.ListIndex = -1
End If

With Worksheets("LOVs")
Set myRng = .Range("ProductFilter") 'Using a dynamic named range
End With

'Clear list index if it already exists.
With lstProductFiltered
.Clear
End With

For Each myCell In myRng.Cells
If LCase(myCell.Value) = LCase(Me.cboxProductLine.Value) Then
Me.lstProductFiltered.AddItem myCell.Offset(0, 1).Value
End If
Next myCell
End Sub

 
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 I filter one list based on another list? Erlend Excel Discussion (Misc queries) 3 April 24th 23 09:08 AM
Formula (not adv. filter) to list unique values from list Brian Excel Worksheet Functions 3 May 12th 09 04:33 AM
How to filter list from pre-existing list mrwawa Excel Discussion (Misc queries) 1 October 13th 06 07:46 PM
Filter the results of a list based on a previous vlookup against the same list Mizpah Excel Worksheet Functions 2 August 18th 06 10:28 AM
How to filter a 2nd list based on selection in 1st list. ImOk Excel Programming 1 July 19th 06 06:54 AM


All times are GMT +1. The time now is 10:58 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"