ListBox Multiple Selection

  • Thread starter Thread starter Todd Huttenstine
  • Start date Start date
T

Todd Huttenstine

Hey guys

I have a ListBox(ListBox1) that is populated with values.
lets say these matching values can be found in Range
E8:E20. They may or may not be in this range. If a value
that is in the ListBox is matches a value in Range E8:E20,
I need for that value in the ListBox to be selected. How
do I do this?

Thank you
Todd Huttenstine
 
Hi Todd,

here is some code

Dim i As Long
Dim j As Long

With Me.ListBox1
For i = 0 To .ListCount - 1
On Error Resume Next
j = WorksheetFunction.Match(.List(i), Range("E8:E20"), 0)
If j > 0 Then .Selected(i) = True
j = 0
Next i
End With

--

HTH

Bob Phillips
... looking out across Poole Harbour to the Purbecks
(remove nothere from the email address if mailing direct)
 
Back
Top